fix: make sure that fallback gets it's own scope with params

This commit is contained in:
rvcas 2024-07-30 17:27:14 -04:00 committed by KtorZ
parent 1d9034573b
commit 9e866a5ec1
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 37 additions and 31 deletions

View File

@ -220,8 +220,11 @@ fn infer_definition(
typed_handlers.push(typed_fun); typed_handlers.push(typed_fun);
} }
let params = params.into_iter().chain(fallback.arguments); let (typed_params, typed_fallback) = environment.in_new_scope(|environment| {
fallback.arguments = params.collect(); let temp_params = params.iter().cloned().chain(fallback.arguments);
fallback.arguments = temp_params.collect();
put_params_in_scope(&fallback.name, environment, &params);
let mut typed_fallback = let mut typed_fallback =
infer_function(&fallback, module_name, hydrators, environment, tracing)?; infer_function(&fallback, module_name, hydrators, environment, tracing)?;
@ -259,6 +262,9 @@ fn infer_definition(
} }
} }
Ok((typed_params, typed_fallback))
})?;
Ok(Definition::Validator(Validator { Ok(Definition::Validator(Validator {
doc, doc,
end_position, end_position,