mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Improve error message for Foo{} when Foo is not a generic type #2574.
This commit is contained in:
30
test/test_suite/generic/generic_no_arg.c3
Normal file
30
test/test_suite/generic/generic_no_arg.c3
Normal file
@@ -0,0 +1,30 @@
|
||||
module foo;
|
||||
import std, bar;
|
||||
struct Foo
|
||||
{
|
||||
int i;
|
||||
}
|
||||
fn void foo(Foo f) {}
|
||||
|
||||
fn void a()
|
||||
{
|
||||
List{} a; // #error: must be instantiatied with generic module arguments
|
||||
}
|
||||
fn void b()
|
||||
{
|
||||
foo(Foo{}); // #error: 'Foo' is not a generic type
|
||||
}
|
||||
fn void c()
|
||||
{
|
||||
bar::test{}(); // #error: must be instantiatied with generic module arguments
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module bar{Type};
|
||||
fn void test()
|
||||
{}
|
||||
@@ -17,12 +17,12 @@ import std::collections::list;
|
||||
|
||||
fn void test1()
|
||||
{
|
||||
int x = values::test{}(); // #error: At least one generic parameter
|
||||
int x = values::test{}(); // #error: must be instantiatied with generic
|
||||
}
|
||||
|
||||
fn void test2()
|
||||
{
|
||||
List{Values{ }} v1s; // #error: At least one generic parameter
|
||||
List{Values{ }} v1s; // #error: must be instantiatied with generic
|
||||
}
|
||||
|
||||
fn void main()
|
||||
|
||||
Reference in New Issue
Block a user