diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index c2c0c2cb6..bdd59c2c5 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -1868,7 +1868,8 @@ void SemanticsDeclHeaderVisitor::checkVarDeclCommon(VarDeclBase* varDecl) if (auto initExpr = varDecl->initExpr) { initExpr = CheckTerm(initExpr); - initExpr = coerce(CoercionSite::Initializer, varDecl->type.Ptr(), initExpr); + initExpr = + coerce(CoercionSite::Initializer, varDecl->type.Ptr(), initExpr, getSink()); varDecl->initExpr = initExpr; maybeInferArraySizeForVariable(varDecl); @@ -2348,7 +2349,7 @@ void SemanticsDeclBodyVisitor::checkVarDeclCommon(VarDeclBase* varDecl) if (initExpr->type.isWriteOnly) getSink()->diagnose(initExpr, Diagnostics::readingFromWriteOnly); - initExpr = coerce(CoercionSite::Initializer, varDecl->type.Ptr(), initExpr); + initExpr = coerce(CoercionSite::Initializer, varDecl->type.Ptr(), initExpr, getSink()); varDecl->initExpr = initExpr; // We need to ensure that any variable doesn't introduce @@ -4948,7 +4949,7 @@ bool SemanticsVisitor::trySynthesizeMethodRequirementWitness( // so we also need to coerce the result of the call to // the expected type. // - auto coercedCall = subVisitor.coerce(CoercionSite::Return, resultType, checkedCall); + auto coercedCall = subVisitor.coerce(CoercionSite::Return, resultType, checkedCall, getSink()); // If our overload resolution or type coercion failed, // then we have not been able to synthesize a witness @@ -5803,7 +5804,7 @@ bool SemanticsVisitor::synthesizeAccessorRequirements( // the expected type of the property. // auto coercedMemberRef = - subVisitor.coerce(CoercionSite::Return, resultType, synBoundStorageExpr); + subVisitor.coerce(CoercionSite::Return, resultType, synBoundStorageExpr, getSink()); auto synReturn = m_astBuilder->create<ReturnStmt>(); synReturn->expression = coercedMemberRef; @@ -8092,7 +8093,7 @@ void SemanticsDeclBodyVisitor::visitEnumCaseDecl(EnumCaseDecl* decl) if (auto initExpr = decl->tagExpr) { initExpr = CheckTerm(initExpr); - initExpr = coerce(CoercionSite::General, tagType, initExpr); + initExpr = coerce(CoercionSite::General, tagType, initExpr, getSink()); // We want to enforce that this is an integer constant // expression. @@ -9139,7 +9140,7 @@ void SemanticsDeclBodyVisitor::visitParamDecl(ParamDecl* paramDecl) // actual type of the parameter. // initExpr = CheckTerm(initExpr); - initExpr = coerce(CoercionSite::Initializer, typeExpr.type, initExpr); + initExpr = coerce(CoercionSite::Initializer, typeExpr.type, initExpr, getSink()); paramDecl->initExpr = initExpr; // TODO: a default argument expression needs to @@ -9284,7 +9285,7 @@ void SemanticsDeclBodyVisitor::synthesizeCtorBodyForBases( invoke->arguments.addRange(argumentList); auto assign = m_astBuilder->create<AssignExpr>(); - assign->left = coerce(CoercionSite::Initializer, declRefType, thisExpr); + assign->left = coerce(CoercionSite::Initializer, declRefType, thisExpr, getSink()); assign->right = invoke; auto stmt = m_astBuilder->create<ExpressionStmt>(); |
