Match polymorphic procedure specializations by parameter names at every depth so they no longer depend on which call site is checked first

This commit is contained in:
gingerBill committed 2026-10-05 12:28:46 +01:00
1 parent c5cfff4e3c
commit bcf0ac7b21
2 files changed
+29 -84

No files matched your search

+4 -3
View File
@@ -709,7 +709,8 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
}
Entity *other = gen_procs->procs[i];
Type *pt = base_type(proc_entity_full_type(other));
if (are_types_identical(pt, final_proc_type)) {
// NOTE(bill): parameter names need to be included too as `typeid`s and link names include them
if (are_types_identical_unique_tuples(pt, final_proc_type)) {
rw_mutex_shared_unlock(&gen_procs->mutex); // @local-mutex
if (poly_proc_data) {
@@ -755,7 +756,7 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
}
Entity *other = gen_procs->procs[i];
Type *pt = base_type(proc_entity_full_type(other));
if (are_types_identical(pt, final_proc_type)) {
if (are_types_identical_unique_tuples(pt, final_proc_type)) {
rw_mutex_shared_unlock(&gen_procs->mutex); // @local-mutex
return reuse_gen_polymorphic_procedure(other, poly_proc_data);
}
@@ -770,7 +771,7 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
rw_mutex_lock(&gen_procs->mutex); // @local-mutex
for_array(i, gen_procs->procs) {
Entity *other = gen_procs->procs[i];
if (gen_procs->hashes[i] == final_hash && are_types_identical(base_type(proc_entity_full_type(other)), final_proc_type)) {
if (gen_procs->hashes[i] == final_hash && are_types_identical_unique_tuples(base_type(proc_entity_full_type(other)), final_proc_type)) {
rw_mutex_unlock(&gen_procs->mutex); // @local-mutex
return reuse_gen_polymorphic_procedure(other, poly_proc_data);
}