Skip to content

Commit

Permalink
fix incorrect overload candidate resolution
Browse files Browse the repository at this point in the history
fix incorrect overload candidate resolution to allow AssocType to function with StructDecl resolution.
  • Loading branch information
ArielG-NV committed Sep 5, 2024
1 parent 7312af1 commit 92ed12a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/slang/slang-check-overload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,11 @@ namespace Slang
OverloadCandidate* left,
OverloadCandidate* right)
{
// If candidates are equal (which is possible if we have an overload from `AssocType` and `StructDecl`)
// We need to pick 1 to keep. Overlapping lookups with `__init()` are common with auto-diff.
if (left->item.declRef == right->item.declRef)
return -1;

// If one candidate got further along in validation, pick it
if (left->status != right->status)
return int(right->status) - int(left->status);
Expand Down

0 comments on commit 92ed12a

Please sign in to comment.