diff --git a/src/compiler/sema_name_resolution.c b/src/compiler/sema_name_resolution.c index 7a94e3ee7..22c13905c 100644 --- a/src/compiler/sema_name_resolution.c +++ b/src/compiler/sema_name_resolution.c @@ -849,7 +849,7 @@ INLINE bool sema_resolve_symbol_common(SemaContext *context, NameResolve *name_r if (symbol) return name_resolve->found = symbol, true; } if (name_resolve->suppress_error) return name_resolve->found = NULL, true; - RETURN_SEMA_ERROR_AT(name_resolve->span, "'%s' is defined in the generic module '%s', but no parameters where given.", found->name, found->unit->module->name->module); + RETURN_SEMA_ERROR_AT(name_resolve->span, "'%s' is defined in the generic module '%s', did you forget the parameters '{ ... }'?", found->name, found->unit->module->name->module); } else { diff --git a/test/test_suite/generic/generic_lookup.c3 b/test/test_suite/generic/generic_lookup.c3 index 49e243d1a..800495454 100644 --- a/test/test_suite/generic/generic_lookup.c3 +++ b/test/test_suite/generic/generic_lookup.c3 @@ -1,5 +1,5 @@ module test; - +import std::collections::elastic_array; fn void a() { List {int} x; // #error: Did you mean the struct 'List' in module std::collections::list? If so please add @@ -17,15 +17,30 @@ fn void c() fn void d() { - list::type_is_overaligned(); // #error: Did you mean the macro 'type_is_overaligned' in the generic module std::collections::list? If so, use 'type_is_overaligned{...}' instead + list::type_is_overaligned(); // #error: Did you mean the macro 'std::collections::list::type_is_overaligned' in module std::collections::list? If so please add 'import std::collections::list' +} + +fn void d2() +{ + elastic_array::type_is_overaligned(); // #error: 'type_is_overaligned' is defined in the generic module 'std::collections::elastic_array', did you forget the parameters '{ ... }'? } fn void e() { - List x; // #error: Did you mean the struct 'List' in the generic module std::collections::list? If so, use 'List{...}' + List x; // #error: Did you mean the struct 'List' in module std::collections::list? If so please add 'import std::collections::list' +} + +fn void f() +{ + ElasticArray x; // #error: 'ElasticArray' is defined in the generic module 'std::collections::elastic_array', did you forget the parameters '{ ... }'? +} + +fn void g() +{ + (ElasticArray){}; // #error: 'ElasticArray' is defined in the generic module 'std::collections::elastic_array', did you forget the parameters '{ ... }' } fn int main(String[] args) { return 0; -} +} \ No newline at end of file diff --git a/test/test_suite/generic/generic_without_param.c3 b/test/test_suite/generic/generic_without_param.c3 index 6896fe08c..c8d869627 100644 --- a/test/test_suite/generic/generic_without_param.c3 +++ b/test/test_suite/generic/generic_without_param.c3 @@ -3,7 +3,7 @@ import std; import abc; fn void main() { - abc::test(); // #error: but no parameters where given + abc::test(); // #error: 'test' is defined in the generic module 'abc', did you } module abc{Type}; fn void test() {} \ No newline at end of file diff --git a/test/test_suite/generic/used_without_param2.c3 b/test/test_suite/generic/used_without_param2.c3 index 656f16403..92be3d148 100644 --- a/test/test_suite/generic/used_without_param2.c3 +++ b/test/test_suite/generic/used_without_param2.c3 @@ -5,6 +5,6 @@ import std::collections::maybe; fn void test() { maybe::Maybe{float} f = (Maybe) {.value=6.6, .has_value=true}; - Maybe x; // #error: but no parameters where given + Maybe x; // #error: 'Maybe' is defined in the generic module 'std::collections::maybe', did you forget the parameters '{ ... }' }