summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-conformance.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-14 14:14:18 -0700
committerGitHub <noreply@github.com>2024-03-14 14:14:18 -0700
commit78d4df0644b20b8ba4eeff459c749c4e8d261345 (patch)
tree0fec98d03281134cc46a0cc96cfd48b6107b159f /source/slang/slang-check-conformance.cpp
parentba65c212f71a9033c11657936f202f67b01abf23 (diff)
Add diagnostic on invalid type constraint. (#3769)
Diffstat (limited to 'source/slang/slang-check-conformance.cpp')
-rw-r--r--source/slang/slang-check-conformance.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp
index d6e73e798..ff4a40031 100644
--- a/source/slang/slang-check-conformance.cpp
+++ b/source/slang/slang-check-conformance.cpp
@@ -237,6 +237,15 @@ namespace Slang
return false;
}
+ bool SemanticsVisitor::isValidGenericConstraintType(Type* type)
+ {
+ if (auto andType = as<AndType>(type))
+ {
+ return isValidGenericConstraintType(andType->getLeft()) && isValidGenericConstraintType(andType->getRight());
+ }
+ return isInterfaceType(type);
+ }
+
bool SemanticsVisitor::isTypeDifferentiable(Type* type)
{
return isSubtype(type, m_astBuilder->getDiffInterfaceType());