From 3702a99d03a8c40659af6053115ed3fe93645c94 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Tue, 17 Dec 2024 19:30:42 +0100 Subject: [PATCH] fixing another incorrect file reporting Signed-off-by: Jakub Doka --- lang/src/son.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index 9c9417b..e41fbf1 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -2560,8 +2560,6 @@ impl<'a> Codegen<'a> { } self.ci.ret = prev_ret; - self.ci.file = prev_file; - self.ci.parent = prev_parent; self.ci.inline_depth -= 1; self.ci.inline_var_base = prev_var_base; self.ci.inline_aclass_base = prev_aclass_base; @@ -2583,6 +2581,10 @@ impl<'a> Codegen<'a> { self.error(body.pos(), "function is makred inline but it contains controlflow"); } + // this is here because we report error in the inline function file + self.ci.file = prev_file; + self.ci.parent = prev_parent; + scope.vars.drain(var_base..).for_each(|v| v.remove(&mut self.ci.nodes)); scope.aclasses.drain(aclass_base..).for_each(|v| v.remove(&mut self.ci.nodes)); self.ci.nodes.unlock(v.id); @@ -2849,7 +2851,9 @@ impl<'a> Codegen<'a> { self.tys.tmp.args.push(ty); let sym = parser::find_symbol(&fast.symbols, carg.id); - let ty = if sym.flags & idfl::COMPTIME == 0 { + let ty = if ty == ty::Id::ANY_TYPE { + todo!() + } else if sym.flags & idfl::COMPTIME == 0 { // FIXME: could fuck us continue; } else { @@ -3772,6 +3776,7 @@ impl<'a> Codegen<'a> { { self.find_type(pos, sc.file, inside, name) } + Expr::Directive { name: "Any", args: [], .. } => ty::Id::ANY_TYPE, Expr::Directive { name: "TypeOf", args: [expr], .. } => self.infer_type(expr), Expr::Slice { size: None, item, .. } => { let ty = self.parse_ty(sc.anon(), item);