mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Further fix shadowing of generics
This commit is contained in:
@@ -41,7 +41,7 @@ macro void quicksort_indexed(list, start, end, cmp = ..., context = ...) @builti
|
||||
$endif
|
||||
}
|
||||
|
||||
module std::sort <Type, KeyFn> @private;
|
||||
module std::sort <Type, KeyFn> @local;
|
||||
|
||||
alias Counts @private = usz[256];
|
||||
alias Ranges @private = usz[257];
|
||||
@@ -66,12 +66,12 @@ macro list_get(ListType l, i) @if(IS_SLICE) => l[i];
|
||||
macro list_get_ref(ListType l, i) @if(!IS_SLICE) => &(*l)[i];
|
||||
macro list_get_ref(ListType l, i) @if(IS_SLICE) => &l[i];
|
||||
|
||||
fn void csort(ListType list, usz low, usz high, KeyFn key_fn, uint byte_idx) @if (!NO_KEY_FN)
|
||||
fn void csort(ListType list, usz low, usz high, KeyFn key_fn, uint byte_idx) @if (!NO_KEY_FN) @private
|
||||
{
|
||||
_csort(list, low, high, byte_idx, key_fn);
|
||||
}
|
||||
|
||||
fn void csort(ListType list, usz low, usz high, uint byte_idx) @if (NO_KEY_FN)
|
||||
fn void csort(ListType list, usz low, usz high, uint byte_idx) @if (NO_KEY_FN) @private
|
||||
{
|
||||
_csort(list, low, high, byte_idx);
|
||||
}
|
||||
|
||||
@@ -276,8 +276,30 @@ static void register_generic_decls(CompilationUnit *unit, Decl **decls)
|
||||
if (decl->func_decl.type_parent) continue;
|
||||
break;
|
||||
}
|
||||
htable_set(&unit->module->symbols, (void *)decl->name, decl);
|
||||
htable_set(&unit->local_symbols, (void *)decl->name, decl);
|
||||
Decl *old;
|
||||
if (decl->visibility < VISIBLE_LOCAL)
|
||||
{
|
||||
if ((old = htable_set(&unit->module->symbols, (void *)decl->name, decl)))
|
||||
{
|
||||
if (old->generic_id != decl->generic_id)
|
||||
{
|
||||
sema_shadow_error(NULL, decl, old);
|
||||
decl_poison(decl);
|
||||
decl_poison(old);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((old = htable_set(&unit->local_symbols, (void *)decl->name, decl)))
|
||||
{
|
||||
if (old->generic_id != decl->generic_id)
|
||||
{
|
||||
sema_shadow_error(NULL, decl, old);
|
||||
decl_poison(decl);
|
||||
decl_poison(old);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (decl->visibility == VISIBLE_PUBLIC)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user