Skip to content

Commit

Permalink
Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
csyonghe committed Sep 2, 2024
1 parent 72384ff commit 5db5698
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/slang/slang-check-overload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,7 @@ namespace Slang
for (auto& arg : expr->arguments)
{
arg = maybeOpenRef(arg);
arg = maybeOpenExistential(arg);
}

context.originalExpr = expr;
Expand Down Expand Up @@ -2394,6 +2395,10 @@ namespace Slang
// the user the most help we can.
if (shouldAddToCache)
typeCheckingCache->resolvedOperatorOverloadCache[key] = *context.bestCandidate;

// Now that we have resolved the overload candidate, we need to undo an `openExistential`
// operation that was applied to `out` arguments.
//
auto funcType = context.bestCandidate->funcType;
ShortList<ParameterDirection> paramDirections;
if (funcType)
Expand Down Expand Up @@ -2421,12 +2426,13 @@ namespace Slang
case kParameterDirection_InOut:
case kParameterDirection_Ref:
case kParameterDirection_ConstRef:
continue;
default:
break;
default:
continue;
}
}
arg = maybeOpenExistential(arg);
if (auto extractExistentialExpr = as<ExtractExistentialValueExpr>(arg))
arg = extractExistentialExpr->originalExpr;
}
return CompleteOverloadCandidate(context, *context.bestCandidate);
}
Expand Down

0 comments on commit 5db5698

Please sign in to comment.