diff --git a/dora/src/typeck/lookup.rs b/dora/src/typeck/lookup.rs index a0c739e4..ff53eccb 100644 --- a/dora/src/typeck/lookup.rs +++ b/dora/src/typeck/lookup.rs @@ -283,11 +283,11 @@ impl<'a, 'ast> MethodLookup<'a, 'ast> { let fct_params = fct .params_without_self() .iter() - .map(|a| a.name_fct(self.vm, self.caller)) + .map(|a| a.name_fct(self.vm, &*fct)) .collect::>(); let call_types = args .iter() - .map(|a| a.name_fct(self.vm, self.caller)) + .map(|a| a.name_fct(self.vm, &*fct)) .collect::>(); let msg = SemError::ParamTypesIncompatible(fct_name, fct_params, call_types); self.vm diff --git a/dora/src/typeck/tests.rs b/dora/src/typeck/tests.rs index 25bb5778..a2b25b4b 100644 --- a/dora/src/typeck/tests.rs +++ b/dora/src/typeck/tests.rs @@ -2212,3 +2212,15 @@ fn check_no_type_params_with_generic_type() { fn enum_with_type_param() { ok("enum MyOption[T: SomeTrait] { None, Some(T) }"); } + +#[test] +fn check_wrong_number_type_params() { + err( + " + fun foo() { bar[Int32](false); } + fun bar[T](x: T) {} + ", + pos(2, 35), + SemError::ParamTypesIncompatible("bar".into(), vec!["T".into()], vec!["Bool".into()]), + ); +}