summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-type.cpp
diff options
context:
space:
mode:
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);