mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Loosen generic resolution.
This commit is contained in:
@@ -858,9 +858,10 @@ INLINE bool sema_resolve_symbol_common(SemaContext *context, NameResolve *name_r
|
||||
{
|
||||
if (found->unit->module->generic_module == context->unit->module->generic_module)
|
||||
{
|
||||
RETURN_SEMA_ERROR_AT(name_resolve->span, "Generating a parameterized %s '%s' in the same module as the original "
|
||||
"is not allowed, you need to place it outside of the '%s' module.",
|
||||
str, found->name, context->unit->module->generic_module->name->module);
|
||||
Decl *decl = module_find_symbol(context->unit->module->generic_module, found->name);
|
||||
ASSERT(decl);
|
||||
name_resolve->found = decl;
|
||||
return true;
|
||||
}
|
||||
RETURN_SEMA_ERROR_AT(name_resolve->span, "This %s was matched as '%s%s' in module '%s%s', so parameterizing it further doesn't work.", str, found->name, found->unit->module->generic_suffix, found->unit->module->generic_module->name->module, found->unit->module->generic_suffix);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ struct Widget
|
||||
List {any} children;
|
||||
}
|
||||
|
||||
fn void Widget{Label}.draw(Widget* self) // #error: same module as the original is not allowed, you need to place it outside
|
||||
fn void Widget{Label}.draw(Widget* self) // #error: The same method is generated by multiple instances
|
||||
{
|
||||
io::printfn("Hello Label");
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ Aa {int} a;
|
||||
|
||||
module test1 {Type};
|
||||
import test2;
|
||||
alias Cc = Aa {Bb {Type}}; // #error:in the same module as the original is not allowed
|
||||
alias Cc = Aa {Bb {Type}}; // #error: Generic resolution of this type has become deeply nested
|
||||
struct Aa {Type a;}
|
||||
|
||||
module test2 {Type};
|
||||
|
||||
Reference in New Issue
Block a user