aboutsummaryrefslogtreecommitdiff
path: root/src/checker_signature.rs
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-05-05 16:39:43 +0100
committertslil <tslil@posteo.de>2026-05-05 16:50:03 +0100
commit9b3fe7ceb8aa0b0f174a17e6e13b5d325c974979 (patch)
treee62b7264afe174a7e10f689a0d65a384a4f72e4b /src/checker_signature.rs
parent27ed463f264a701e336eddc86452fa41f28dd111 (diff)
repair binding for nesting in for
Diffstat (limited to 'src/checker_signature.rs')
-rw-r--r--src/checker_signature.rs25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/checker_signature.rs b/src/checker_signature.rs
index 0145e82..cc6cadc 100644
--- a/src/checker_signature.rs
+++ b/src/checker_signature.rs
@@ -371,9 +371,15 @@ impl CheckerState {
// deal with left-nesting
let mut ctx = self.clone();
- for Param { name, set } in inst_params {
- ctx.make_element_binding(name.clone(), set.clone())?;
- }
+ let inst_params: Vec<Param> = inst_params
+ .iter()
+ .map(|Param { name, set }| {
+ let set = ctx.check_set(set)?;
+ let canon = ctx.make_element_binding(name.clone(), set.clone())?;
+ Ok(Param { name: canon, set })
+ })
+ .collect::<Result<_, _>>()?;
+
let body = ctx.check_instance(body, None)?;
let (inst_params, body) = if let Instance::For {
params: inner_params,
@@ -467,19 +473,6 @@ impl CheckerState {
params: inst_params,
})
} else {
- let mut ctx = self.clone();
- let inst_params = inst_params
- .iter()
- .map(|Param { name, set }| {
- let set = ctx.check_set(set)?;
- let canon = ctx.make_element_binding(name.clone(), set.clone())?;
- Ok(Param {
- name: canon,
- set: set,
- })
- })
- .collect::<Result<Vec<_>, _>>()?;
- let body = ctx.check_instance(&body, None)?;
Ok(Instance::For {
params: inst_params,
body: Box::new(body),