From d220823d782dca70601146d4b5bcd00835ba8996 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sat, 21 Dec 2024 17:14:33 +0100 Subject: [PATCH] fixing the bug in previous commit Signed-off-by: Jakub Doka --- lang/src/son.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index 1c93374..f9242fa 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -851,12 +851,15 @@ impl<'a> Codegen<'a> { if let Some((captures, capture_tuple)) = self.tys.captures_of(piter, f) && let Some(idx) = captures.iter().position(|&cid| cid.id == id) { - let ty = if captures[idx].is_ct { - ty::Id::TYPE + if captures[idx].is_ct { + let ty = self.tys.ins.args[capture_tuple.range().start + idx]; + break Some(self.ci.nodes.new_const_lit(ty::Id::TYPE, ty)); } else { - self.tys.ins.args[capture_tuple.range().start + idx] - }; - break Some(Value::new(NEVER).ty(ty)); + break Some( + Value::new(NEVER) + .ty(self.tys.ins.args[capture_tuple.range().start + idx]), + ); + } } piter = match self.tys.parent_of(piter) {