diff options
| author | Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> | 2024-04-27 02:27:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-26 23:27:28 -0700 |
| commit | 2b87c00c671b156b8e5926f8967003bf12c65aa7 (patch) | |
| tree | c993872a1b9a568ea4c963b2c710c12f496cc559 /source | |
| parent | e91bd3b0bdc50f66bfd302ff079c65fba5126474 (diff) | |
Fix invoke resolution when dealing with overloded type expressions (#4043)
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-check-overload.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp index 6180ccda8..703771e6e 100644 --- a/source/slang/slang-check-overload.cpp +++ b/source/slang/slang-check-overload.cpp @@ -2093,7 +2093,21 @@ namespace Slang typeCheckingCache->resolvedOperatorOverloadCache[key] = *context.bestCandidate; return CompleteOverloadCandidate(context, *context.bestCandidate); } - else if (auto typetype = as<TypeType>(funcExprType)) + + // If absolutely no viable candidates were extracted from the overloaded expression, + // we may be dealing with a composite type or an overloaded expression with composite types. + // + + auto typeExpr = funcExpr; + if (auto overloadedExpr = as<OverloadedExpr>(funcExpr)) + { + if (overloadedExpr->lookupResult2.isValid() && overloadedExpr->lookupResult2.isOverloaded()) + { + typeExpr = maybeResolveOverloadedExpr(overloadedExpr, LookupMask::type, nullptr); + } + } + + if (auto typetype = as<TypeType>(typeExpr->type)) { // We allow a special case when `funcExpr` represents a composite type, // in which case we will try to construct the type via memberwise assignment from the arguments. |
