summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-check-conformance.cpp14
-rw-r--r--source/slang/slang-syntax.h5
2 files changed, 18 insertions, 1 deletions
diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp
index 174d4be89..b95df520d 100644
--- a/source/slang/slang-check-conformance.cpp
+++ b/source/slang/slang-check-conformance.cpp
@@ -211,6 +211,20 @@ namespace Slang
auto inheritedType = getBaseType(m_astBuilder, inheritanceDeclRef);
+
+ // There's one annoying corner case where something that *looks* like an inheritnace
+ // declaration isn't actually one, and that is when an `enum` type includes an explicit
+ // declaration of its "tag type."
+ //
+ if (auto enumDeclRef = declRef.as<EnumDecl>())
+ {
+ if (inheritedType->equals(getTagType(m_astBuilder, enumDeclRef)))
+ {
+ return;
+ }
+ }
+
+
// We need to ensure that the witness that gets created
// is a composite one, reflecting lookup through
// the inheritance declaration.
diff --git a/source/slang/slang-syntax.h b/source/slang/slang-syntax.h
index 9589f00fd..a23ad224e 100644
--- a/source/slang/slang-syntax.h
+++ b/source/slang/slang-syntax.h
@@ -136,7 +136,10 @@ namespace Slang
return getMembersOfType<VarDecl>(declRef, filterStyle);
}
-
+ inline Type* getTagType(ASTBuilder* astBuilder, DeclRef<EnumDecl> const& declRef)
+ {
+ return declRef.substitute(astBuilder, declRef.getDecl()->tagType);
+ }
inline Type* getBaseType(ASTBuilder* astBuilder, DeclRef<InheritanceDecl> const& declRef)
{