From d3ad6bb4997d3b7ba2dc9653a2d5f7dc965b150f Mon Sep 17 00:00:00 2001 From: Julius Ikkala Date: Fri, 17 Jan 2025 03:06:00 +0200 Subject: 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 --- source/slang/slang-check-decl.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source/slang/slang-check-decl.cpp') 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()) - toExclude = parent; - SemanticsDeclVisitorBase baseVistor(this->withDeclToExcludeFromLookup(toExclude)); + context = context.excludeTransparentMembersFromLookup(); + SemanticsDeclVisitorBase baseVistor(context); baseVistor.CheckConstraintSubType(base); base = baseVistor.TranslateTypeNode(base); inheritanceDecl->base = base; -- cgit v1.2.3