diff --git a/releasenotes.md b/releasenotes.md index d046f15b9..efd24aeb7 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -33,6 +33,7 @@ - Wrong size for structs containing overaligned structs #1219 - $typeof(*x) should be valid when x is an `[out]` parameter #1226 - Fix ABI lowering for 128 bit vectors on Linux. +- Bad error message when using a generic method without generic parameters #1228 ### Stdlib changes - Added `remove_first_item` `remove_last_item` and `remove_item` as aliases for the `match` functions. diff --git a/src/compiler/sema_name_resolution.c b/src/compiler/sema_name_resolution.c index 647c84132..27c0edab1 100644 --- a/src/compiler/sema_name_resolution.c +++ b/src/compiler/sema_name_resolution.c @@ -519,8 +519,9 @@ INLINE Decl *sema_resolve_symbol_common(SemaContext *context, NameResolve *name_ { if (matches_subpath(module->name, name_resolve->path)) { - module_with_path = module; - break; + SEMA_ERROR(name_resolve->path, "%s is a generic module, did you forget to add the generic parameter(s) (<...>) after '%s'?", + module->name->module, name_resolve->symbol); + return poisoned_decl; } } } diff --git a/test/test_suite/generic/generic_without_param.c3 b/test/test_suite/generic/generic_without_param.c3 new file mode 100644 index 000000000..a1915f162 --- /dev/null +++ b/test/test_suite/generic/generic_without_param.c3 @@ -0,0 +1,9 @@ +module test; +import std; +import abc; +fn void main() +{ + abc::test(); // #error: (<...>) +} +module abc(); +fn void test() {} \ No newline at end of file