From 83876733d69582eec6bad26af64a651d40fa43aa Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 21 Mar 2023 20:03:12 -0700 Subject: 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 --- source/slang/slang-ast-type.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/slang/slang-ast-type.cpp') 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(declRef.getDecl())) { if (auto result = maybeSubstituteGenericParam(this, genericTypeParamDecl, subst, ioDiff)) + { + if (auto substDeclRefType = as(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 substDeclRef = declRef.substituteImpl(astBuilder, subst, &diff); -- cgit v1.2.3