summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-syntax.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-31 09:52:51 -0800
committerGitHub <noreply@github.com>2024-12-31 09:52:51 -0800
commita8471a1d9a5591202bf4a552aa7d1bf11088fdce (patch)
treebd8c9fe1c761c5328f0c6485fc9d31d8e3ec69c2 /source/slang/slang-syntax.cpp
parentb7eb585241b3f3519ff494004efedae680cb44b9 (diff)
Fix `getInheritanceInfo` for `ExtractExistentialType`. (#5971)
Diffstat (limited to 'source/slang/slang-syntax.cpp')
-rw-r--r--source/slang/slang-syntax.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index 5dc6ca695..6fdd5088a 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -701,11 +701,18 @@ Type* DeclRefType::create(ASTBuilder* astBuilder, DeclRef<Decl> declRef)
}
return declRefType;
}
- else if (as<ThisTypeDecl>(declRef.getDecl()) && as<DirectDeclRef>(declRef.declRefBase))
+ else if (as<ThisTypeDecl>(declRef.getDecl()))
{
- declRef = createDefaultSubstitutionsIfNeeded(astBuilder, nullptr, declRef);
+ if (as<DirectDeclRef>(declRef.declRefBase))
+ {
+ declRef = createDefaultSubstitutionsIfNeeded(astBuilder, nullptr, declRef);
- return astBuilder->getOrCreate<ThisType>(declRef.declRefBase);
+ return astBuilder->getOrCreate<ThisType>(declRef.declRefBase);
+ }
+ else if (auto lookupDeclRef = as<LookupDeclRef>(declRef.declRefBase))
+ {
+ return lookupDeclRef->getWitness()->getSub();
+ }
}
else if (auto typedefDecl = as<TypeDefDecl>(declRef.getDecl()))
{
@@ -714,12 +721,9 @@ Type* DeclRefType::create(ASTBuilder* astBuilder, DeclRef<Decl> declRef)
typedefDecl->type.type->substitute(astBuilder, SubstitutionSet(declRef)));
return astBuilder->getErrorType();
}
- else
- {
- declRef = createDefaultSubstitutionsIfNeeded(astBuilder, nullptr, declRef);
- return astBuilder->getOrCreate<DeclRefType>(declRef.declRefBase);
- }
+ declRef = createDefaultSubstitutionsIfNeeded(astBuilder, nullptr, declRef);
+ return astBuilder->getOrCreate<DeclRefType>(declRef.declRefBase);
}
//