diff options
| author | Yong He <yonghe@outlook.com> | 2023-04-13 16:40:36 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-13 16:40:36 -0700 |
| commit | 3bbac5f16e9dd47acd2132c0bb2a43393831c450 (patch) | |
| tree | bddf137c252c164f7cd08f1f58b559b96ee49419 /source/slang/slang-check-expr.cpp | |
| parent | 3b4a50d74059a26af2ed8c37fb2042f33ba7cf2c (diff) | |
Warn on float-to-double coercion for arguments. (#2802)
* Warn on float-to-double coercion for arguments.
* Fix test.
* Rename.
* Fixup.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 0f744997d..507b8c30f 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -1618,13 +1618,13 @@ namespace Slang switch (coercionType) { case IntegerConstantExpressionCoercionType::SpecificType: - expr = coerce(expectedType, inExpr); + expr = coerce(CoercionSite::General, expectedType, inExpr); break; case IntegerConstantExpressionCoercionType::AnyInteger: if (isScalarIntegerType(inExpr->type)) expr = inExpr; else - expr = coerce(m_astBuilder->getIntType(), inExpr); + expr = coerce(CoercionSite::General, m_astBuilder->getIntType(), inExpr); break; default: break; @@ -1862,7 +1862,7 @@ namespace Slang expr->left = maybeOpenRef(expr->left); auto type = expr->left->type; auto right = maybeOpenRef(expr->right); - expr->right = coerce(type, right); + expr->right = coerce(CoercionSite::Assignment, type, right); if (!type.isLeftValue) { @@ -2650,7 +2650,7 @@ namespace Slang initListExpr->loc = expr->loc; auto checkedInitListExpr = visitInitializerListExpr(initListExpr); - return coerce(typeExp.type, checkedInitListExpr); + return coerce(CoercionSite::General, typeExp.type, checkedInitListExpr); } } } |
