summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-09-05 11:24:19 -0700
committerGitHub <noreply@github.com>2024-09-05 11:24:19 -0700
commitd655302465457c5d3285ae5339201a0769cc38dc (patch)
tree4c0946ba4ea4879831133370d2203f569c135c35 /source/slang/slang-ir.cpp
parenta88055c6f5190ca62bb4aa853b4f0fa11546278f (diff)
Support `where` clause and type equality constraint. (#4986)
* Support `where` clause. * Fix. * Fix parser. * Enhance test to cover traditional __generic syntax. * Update user-guide. * Support `where` clause on associatedtype. * Fix. * Put in more comments.
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index acc6abd57..d02c01105 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -4614,6 +4614,15 @@ namespace Slang
return witness;
}
+ IRInst* IRBuilder::getTypeEqualityWitness(IRType* witnessType, IRType* type1, IRType* type2)
+ {
+ IRInst* operands[2] = { type1, type2 };
+ return (IRType*)createIntrinsicInst(
+ witnessType,
+ kIROp_TypeEqualityWitness,
+ 2,
+ operands);
+ }
IRStructType* IRBuilder::createStructType()
{
@@ -8347,6 +8356,7 @@ namespace Slang
case kIROp_InterfaceRequirementEntry:
case kIROp_Block:
case kIROp_Each:
+ case kIROp_TypeEqualityWitness:
return false;
/// Liveness markers have no side effects