summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-check-expr.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp
index ee36a21fb..f60ead1e9 100644
--- a/source/slang/slang-check-expr.cpp
+++ b/source/slang/slang-check-expr.cpp
@@ -638,7 +638,12 @@ namespace Slang
auto typeDef = m_astBuilder->create<TypeAliasDecl>();
typeDef->nameAndLoc.name = item.declRef.getName();
typeDef->parentDecl = parent;
- typeDef->type.type = subType;
+
+ // Compute the decl's type as if it is referred to from itself. This is important because
+ // subType may have substitutions from the context it is used in, while this synthesis step
+ // is local to the decl.
+ //
+ typeDef->type.type = calcThisType(subType->getDeclRef().getDecl()->getDefaultDeclRef());
synthesizedDecl = parent;