From 78d4df0644b20b8ba4eeff459c749c4e8d261345 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 14 Mar 2024 14:14:18 -0700 Subject: Add diagnostic on invalid type constraint. (#3769) --- source/slang/slang-check-conformance.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/slang/slang-check-conformance.cpp') 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(type)) + { + return isValidGenericConstraintType(andType->getLeft()) && isValidGenericConstraintType(andType->getRight()); + } + return isInterfaceType(type); + } + bool SemanticsVisitor::isTypeDifferentiable(Type* type) { return isSubtype(type, m_astBuilder->getDiffInterfaceType()); -- cgit v1.2.3