summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-overload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-overload.cpp')
-rw-r--r--source/slang/slang-check-overload.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp
index 71e8488d8..9e5560b3a 100644
--- a/source/slang/slang-check-overload.cpp
+++ b/source/slang/slang-check-overload.cpp
@@ -2727,6 +2727,7 @@ Expr* SemanticsVisitor::ResolveInvoke(InvokeExpr* expr)
//
bool typeOverloadChecked = false;
+ DiagnosticSink collectedErrorsSink(getSourceManager(), nullptr);
if (expr->arguments.getCount() == 1 && !as<ExplicitCtorInvokeExpr>(expr) &&
!as<InitializerListExpr>(expr->arguments[0]))
{
@@ -2735,16 +2736,15 @@ Expr* SemanticsVisitor::ResolveInvoke(InvokeExpr* expr)
if (isDeclRefTypeOf<AggTypeDeclBase>(typeType->getType()))
{
Expr* resultExpr = nullptr;
- DiagnosticSink tempSink(getSourceManager(), nullptr);
ConversionCost conversionCost = kConversionCost_None;
- auto coerceResult = SemanticsVisitor(withSink(&tempSink))
+ auto coerceResult = SemanticsVisitor(withSink(&collectedErrorsSink))
._coerce(
CoercionSite::ExplicitCoercion,
typeType->getType(),
&resultExpr,
expr->arguments[0]->type,
expr->arguments[0],
- &tempSink,
+ &collectedErrorsSink,
&conversionCost);
if (auto resultInvokeExpr = as<InvokeExpr>(resultExpr))
{
@@ -2963,6 +2963,16 @@ Expr* SemanticsVisitor::ResolveInvoke(InvokeExpr* expr)
// for language server to use.
if (IsErrorExpr(outExpr))
{
+ // Drain our error sink of "saved errors"
+ if (collectedErrorsSink.getErrorCount())
+ {
+ Slang::ComPtr<ISlangBlob> blob;
+ collectedErrorsSink.getBlobIfNeeded(blob.writeRef());
+ getSink()->diagnoseRaw(
+ Severity::Error,
+ static_cast<char const*>(blob->getBufferPointer()));
+ }
+
if (auto invokeExpr = as<InvokeExpr>(outExpr))
{
invokeExpr->originalFunctionExpr = typeExpr;