From 2275e18fc052239fe67f3fda68252ad92bb83ca9 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Thu, 15 May 2025 01:55:17 +0000 Subject: 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. --- source/slang/slang-check-impl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-check-impl.h') diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index 6c9a0409d..f0884503f 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -1646,7 +1646,7 @@ public: InitializerListExpr* fromInitializerListExpr); /// Report that implicit type coercion is not possible. - bool _failedCoercion(Type* toType, Expr** outToExpr, Expr* fromExpr); + bool _failedCoercion(Type* toType, Expr** outToExpr, Expr* fromExpr, DiagnosticSink* sink); /// Central engine for implementing implicit coercion logic /// @@ -1674,6 +1674,7 @@ public: Expr** outToExpr, QualType fromType, Expr* fromExpr, + DiagnosticSink* sink, ConversionCost* outCost); /// Check whether implicit type coercion from `fromType` to `toType` is possible. @@ -1698,7 +1699,7 @@ public: Expr* createCastToInterfaceExpr(Type* toType, Expr* fromExpr, Val* witness); /// Implicitly coerce `fromExpr` to `toType` and diagnose errors if it isn't possible - Expr* coerce(CoercionSite site, Type* toType, Expr* fromExpr); + Expr* coerce(CoercionSite site, Type* toType, Expr* fromExpr, DiagnosticSink* sink); // Fill in default substitutions for the 'subtype' part of a type constraint decl void CheckConstraintSubType(TypeExp& typeExp); -- cgit v1.2.3