mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
@builtin was not respected for generic modules #1617.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
### Fixes
|
||||
- Fix bug where `a > 0 ? f() : g()` could cause a compiler crash if both returned `void!`.
|
||||
- `@builtin` was not respected for generic modules #1617.
|
||||
|
||||
### Stdlib changes
|
||||
|
||||
|
||||
@@ -992,7 +992,7 @@ bool unit_resolve_parameterized_symbol(SemaContext *context, NameResolve *name_r
|
||||
sema_report_error_on_decl(context, name_resolve);
|
||||
return false;
|
||||
}
|
||||
if (!decl_is_user_defined_type(name_resolve->found) && !name_resolve->path)
|
||||
if (!decl_is_user_defined_type(name_resolve->found) && !name_resolve->path && !name_resolve->found->is_autoimport)
|
||||
{
|
||||
if (name_resolve->suppress_error) return false;
|
||||
RETURN_SEMA_ERROR(name_resolve, "Function and variables must be prefixed with a path, e.g. 'foo::%s'.", name_resolve->symbol);
|
||||
|
||||
16
test/test_suite/generic/generic_builtin.c3t
Normal file
16
test/test_suite/generic/generic_builtin.c3t
Normal file
@@ -0,0 +1,16 @@
|
||||
module add(<Type>);
|
||||
fn Type add(Type a, Type b) @builtin =>
|
||||
a + b;
|
||||
|
||||
module iadd;
|
||||
fn int iadd(int a, int b) @builtin =>
|
||||
a + b;
|
||||
|
||||
module main;
|
||||
import std::io, add, iadd;
|
||||
|
||||
fn void! main()
|
||||
{
|
||||
io::printfn("%s", iadd(1,2)); // Fine
|
||||
io::printfn("%s", add(<int>)(1,2)); // Error
|
||||
}
|
||||
Reference in New Issue
Block a user