diff --git a/src/instruction/function_call.rs b/src/instruction/function_call.rs index cc4746a6..88bf108f 100644 --- a/src/instruction/function_call.rs +++ b/src/instruction/function_call.rs @@ -290,8 +290,12 @@ impl Generic for FunctionCall { Ok(m) => m, }; - let new_fn = - dec.from_type_map(generics::mangle(dec.name(), &self.generics), ctx, &type_map); + let mut new_fn = + dec.from_type_map(generics::mangle(dec.name(), &self.generics), &type_map); + + if let Err(e) = ctx.type_check(&mut new_fn) { + ctx.error(e); + } // FIXME: No unwrap ctx.add_function(new_fn).unwrap(); diff --git a/src/instruction/function_declaration.rs b/src/instruction/function_declaration.rs index 02911b58..c1665dc5 100644 --- a/src/instruction/function_declaration.rs +++ b/src/instruction/function_declaration.rs @@ -52,7 +52,6 @@ impl FunctionDec { pub fn from_type_map( &self, name: String, - _ctx: &mut Context, type_map: &GenericMap, ) -> FunctionDec { let mut new_fn = self.clone(); @@ -69,12 +68,6 @@ impl FunctionDec { new_arg.set_type(type_map.get(old_generic.get_type()).unwrap().clone()) }); - // FIXME: We also need to generate a new version of each instruction in the - // block - // if let Some(b) = &mut new_fn.block { - // b.resolve_self(ctx); - // } - new_fn }