diff options
| author | Julius Ikkala <julius.ikkala@gmail.com> | 2025-01-17 03:06:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-17 01:06:00 +0000 |
| commit | d3ad6bb4997d3b7ba2dc9653a2d5f7dc965b150f (patch) | |
| tree | 4726f721cec95ec5ea2ec8408a081ca93338e923 /source/slang/slang-check-decl.cpp | |
| parent | e771f1945ed692168a2634d66a0907acc9c68858 (diff) | |
Fix cyclic lookups with UnscopedEnums (#6110)
* Fix cyclic lookups with UnscopedEnums
* Add test with multiple unscoped enums with explicit types
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 2a5b5a4e3..0319eb260 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -2897,14 +2897,13 @@ void SemanticsDeclBasesVisitor::visitInheritanceDecl(InheritanceDecl* inheritanc { // check the type being inherited from auto base = inheritanceDecl->base; - Decl* toExclude = nullptr; Decl* parent = getParentDecl(inheritanceDecl); - // We exclude in the case that a circular reference is possible. This is when a parent is a - // transparent decl. If we just blanket "block" all ensure's of a parent a generic may fail when - // trying to fetch a parent + // We exclude transparent members in the case that a circular reference is + // possible. This is when a parent is also a transparent decl. + SemanticsContext context(*this); if (parent->findModifier<TransparentModifier>()) - toExclude = parent; - SemanticsDeclVisitorBase baseVistor(this->withDeclToExcludeFromLookup(toExclude)); + context = context.excludeTransparentMembersFromLookup(); + SemanticsDeclVisitorBase baseVistor(context); baseVistor.CheckConstraintSubType(base); base = baseVistor.TranslateTypeNode(base); inheritanceDecl->base = base; |
