summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-type.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-03-21 20:03:12 -0700
committerGitHub <noreply@github.com>2023-03-21 20:03:12 -0700
commit83876733d69582eec6bad26af64a651d40fa43aa (patch)
tree641edb23ee4d656b198e1cc840470702f3ac391d /source/slang/slang-ast-type.cpp
parent5d2c5dd9f748d728abf2a4361fca71a7f9ec65b6 (diff)
Fix associated type resolution bug. (#2719)
* Fix associated type resolution bug. * Fix. * Fix language server hinting messed up by breadcrumb nodes. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-type.cpp')
-rw-r--r--source/slang/slang-ast-type.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-ast-type.cpp b/source/slang/slang-ast-type.cpp
index 362503a64..fdbd56377 100644
--- a/source/slang/slang-ast-type.cpp
+++ b/source/slang/slang-ast-type.cpp
@@ -208,8 +208,19 @@ Val* DeclRefType::_substituteImplOverride(ASTBuilder* astBuilder, SubstitutionSe
if (auto genericTypeParamDecl = as<GenericTypeParamDecl>(declRef.getDecl()))
{
if (auto result = maybeSubstituteGenericParam(this, genericTypeParamDecl, subst, ioDiff))
+ {
+ if (auto substDeclRefType = as<DeclRefType>(result))
+ {
+ // After generic substitution, we may be able to further simplify
+ // by looking up the actual type of an associated type.
+ if (auto satisfyingVal = _tryLookupConcreteAssociatedTypeFromThisTypeSubst(
+ astBuilder, substDeclRefType->declRef))
+ return satisfyingVal;
+ }
return result;
+ }
}
+
int diff = 0;
DeclRef<Decl> substDeclRef = declRef.substituteImpl(astBuilder, subst, &diff);