summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-overload.cpp
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-05-15 01:55:17 +0000
committerGitHub <noreply@github.com>2025-05-15 01:55:17 +0000
commit2275e18fc052239fe67f3fda68252ad92bb83ca9 (patch)
tree19cdf1917811e1c40362ef468c5d3d6a20344517 /source/slang/slang-check-overload.cpp
parent8c98714df2198db1aff4ce6c6f7922850e400f80 (diff)
Do not print errors in _coerce when "JustTrying". (#7064)
* Do not print errors in _coerce when "JustTrying". While figuring out which generic-overload works best, `_coerce()` is printing errors and Slang compilation terminates prematurely. When `TryCheckGenericOverloadCandidateTypes()` is calling `_coerce()` in "JustTrying" mode, the error messages should be snoozed. The following logic shows the intention of how to silence the error messages, but the chain of `sink` was broken in the middle and `_coerce()` was using `getSink()` from the SemanticVisitor. val = ExtractGenericArgInteger( arg, getType(m_astBuilder, valParamRef), context.mode == OverloadResolveContext::Mode::JustTrying ? nullptr : getSink()); * Use tempSink when available.
Diffstat (limited to 'source/slang/slang-check-overload.cpp')
-rw-r--r--source/slang/slang-check-overload.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp
index 44fdf45cf..f13f9a99e 100644
--- a/source/slang/slang-check-overload.cpp
+++ b/source/slang/slang-check-overload.cpp
@@ -481,7 +481,11 @@ bool SemanticsVisitor::TryCheckGenericOverloadCandidateTypes(
}
else
{
- arg = coerce(CoercionSite::Argument, getType(m_astBuilder, valParamRef), arg);
+ arg = coerce(
+ CoercionSite::Argument,
+ getType(m_astBuilder, valParamRef),
+ arg,
+ getSink());
}
// If we have an argument to work with, then we will
@@ -712,7 +716,7 @@ bool SemanticsVisitor::TryCheckOverloadCandidateTypes(
}
else
{
- Expr* coercedExpr = coerce(CoercionSite::Argument, paramType, arg.argExpr);
+ Expr* coercedExpr = coerce(CoercionSite::Argument, paramType, arg.argExpr, getSink());
// Check if concrete-to-interface coercion caused loss of l-valueness.
if (coercedExpr && !coercedExpr->type.isLeftValue && paramType.isLeftValue &&
@@ -2650,6 +2654,7 @@ Expr* SemanticsVisitor::ResolveInvoke(InvokeExpr* expr)
&resultExpr,
expr->arguments[0]->type,
expr->arguments[0],
+ &tempSink,
&conversionCost);
if (coerceResult)
return resultExpr;