summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-expr.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-expr.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-expr.cpp')
-rw-r--r--source/slang/slang-check-expr.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp
index d151d37be..41f945763 100644
--- a/source/slang/slang-check-expr.cpp
+++ b/source/slang/slang-check-expr.cpp
@@ -518,7 +518,11 @@ Expr* SemanticsVisitor::constructDerefExpr(Expr* base, QualType elementType, Sou
{
if (auto resPtrType = as<DescriptorHandleType>(base->type))
{
- return coerce(CoercionSite::ExplicitCoercion, resPtrType->getElementType(), base);
+ return coerce(
+ CoercionSite::ExplicitCoercion,
+ resPtrType->getElementType(),
+ base,
+ getSink());
}
auto derefExpr = m_astBuilder->create<DerefExpr>();
@@ -2254,7 +2258,7 @@ IntVal* SemanticsVisitor::CheckIntegerConstantExpression(
switch (coercionType)
{
case IntegerConstantExpressionCoercionType::SpecificType:
- expr = coerce(CoercionSite::General, expectedType, inExpr);
+ expr = coerce(CoercionSite::General, expectedType, inExpr, sink);
break;
case IntegerConstantExpressionCoercionType::AnyInteger:
if (isScalarIntegerType(inExpr->type))
@@ -2262,7 +2266,7 @@ IntVal* SemanticsVisitor::CheckIntegerConstantExpression(
else if (isEnumType(inExpr->type))
expr = inExpr;
else
- expr = coerce(CoercionSite::General, m_astBuilder->getIntType(), inExpr);
+ expr = coerce(CoercionSite::General, m_astBuilder->getIntType(), inExpr, sink);
break;
default:
break;
@@ -2527,7 +2531,7 @@ Expr* SemanticsVisitor::checkAssignWithCheckedOperands(AssignExpr* expr)
type = atomicType->getElementType();
}
auto right = maybeOpenRef(expr->right);
- expr->right = coerce(CoercionSite::Assignment, type, right);
+ expr->right = coerce(CoercionSite::Assignment, type, right, getSink());
if (!expr->left->type.isLeftValue)
{
@@ -2956,7 +2960,7 @@ Expr* SemanticsExprVisitor::convertToLogicOperatorExpr(InvokeExpr* expr)
// to handle if this expression doesn't support short-circuiting.
for (auto& arg : expr->arguments)
{
- arg = coerce(CoercionSite::Argument, m_astBuilder->getBoolType(), arg);
+ arg = coerce(CoercionSite::Argument, m_astBuilder->getBoolType(), arg, getSink());
}
expr->functionExpr = CheckTerm(expr->functionExpr);
@@ -3920,7 +3924,11 @@ Expr* SemanticsExprVisitor::visitTypeCastExpr(TypeCastExpr* expr)
auto checkedInitListExpr = visitInitializerListExpr(initListExpr);
- return coerce(CoercionSite::General, typeExp.type, checkedInitListExpr);
+ return coerce(
+ CoercionSite::General,
+ typeExp.type,
+ checkedInitListExpr,
+ getSink());
}
}
}