summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-constraint.cpp
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2025-07-08 17:18:02 -0700
committerGitHub <noreply@github.com>2025-07-09 00:18:02 +0000
commite036c7f38e3b8b1f0b0e0ac1b4ef22fc6f16963b (patch)
tree75805f1a7deb3df8f2ee6fbc7eb47fc405a24e93 /source/slang/slang-check-constraint.cpp
parent2c4bfce49d9af2414f6a3f70f7221d6890a017e7 (diff)
Fix `extension` incorrectly interacting with `equality` and `type-coercion` constraints (#7578)
* fix problem * cleanup comment * format code * make change more restrictive * format code * push logic update * format code * push test fix * make test more general --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-check-constraint.cpp')
-rw-r--r--source/slang/slang-check-constraint.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/slang/slang-check-constraint.cpp b/source/slang/slang-check-constraint.cpp
index 7c55c440c..7c6f8929a 100644
--- a/source/slang/slang-check-constraint.cpp
+++ b/source/slang/slang-check-constraint.cpp
@@ -363,6 +363,7 @@ DeclRef<Decl> SemanticsVisitor::trySolveConstraintSystem(
ValUnificationContext unificationContext;
unificationContext.optionalConstraint =
constraintDeclRef.getDecl()->hasModifier<OptionalConstraintModifier>();
+ unificationContext.equalityConstraint = constraintDeclRef.getDecl()->isEqualityConstraint;
if (!TryUnifyTypes(
*system,
unificationContext,
@@ -492,6 +493,8 @@ DeclRef<Decl> SemanticsVisitor::trySolveConstraintSystem(
{
if (c.isOptional)
joinType = type;
+ else if (c.isEquality)
+ joinType = type;
else
// failure!
return DeclRef<Decl>();
@@ -970,6 +973,7 @@ bool SemanticsVisitor::TryUnifyTypeParam(
constraint.val = type;
constraint.isUsedAsLValue = type.isLeftValue;
constraint.isOptional = unificationContext.optionalConstraint;
+ constraint.isEquality = unificationContext.equalityConstraint;
constraints.constraints.add(constraint);
return true;