diff options
| author | Yong He <yonghe@outlook.com> | 2024-11-06 16:42:14 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-06 16:42:14 -0800 |
| commit | 989847f6a9408b68e90ac242f4a19d3266054c3e (patch) | |
| tree | 1cfeb1b12f0c6d1de2669936878cce0f4c542709 /source/slang/slang-check-constraint.cpp | |
| parent | d9cb281f5fd456d6a1df2e8e156810a86f56fc6e (diff) | |
Fix IntVal unification logic to insert type casts + buffer element lowering regression. (#5508)
* Fix IntVal unification logic to insert type casts.
* Fix regression.
Diffstat (limited to 'source/slang/slang-check-constraint.cpp')
| -rw-r--r-- | source/slang/slang-check-constraint.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/slang-check-constraint.cpp b/source/slang/slang-check-constraint.cpp index 13e3e4be6..872d2616c 100644 --- a/source/slang/slang-check-constraint.cpp +++ b/source/slang/slang-check-constraint.cpp @@ -925,6 +925,12 @@ bool SemanticsVisitor::TryUnifyIntParam( // We want to constrain the given parameter to equal the given value. Constraint constraint; constraint.decl = paramDecl; + // If `val` is of different type than `paramDecl`, we want to insert a type cast. + if (val->getType() != paramDecl->getType()) + { + auto cast = m_astBuilder->getTypeCastIntVal(paramDecl->getType(), val); + val = cast; + } constraint.val = val; constraints.constraints.add(constraint); |
