diff options
| author | Yong He <yonghe@outlook.com> | 2017-12-28 23:32:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-28 23:32:02 -0500 |
| commit | bdc1fa5977ec22c2e3b0b8e791cb63f19f9a26f4 (patch) | |
| tree | 6b1fdcdcdc47f0a88194238e7f0b5144c1249b3a /source/slang/syntax.cpp | |
| parent | bcfe8366d2f094bfabccc0014c7248bc46dbf514 (diff) | |
| parent | 37cff92604729a477ff259ef2b561ae9999aac90 (diff) | |
Merge pull request #342 from csyonghe/fix-341
Fix type substitution for associatedtype
Diffstat (limited to 'source/slang/syntax.cpp')
| -rw-r--r-- | source/slang/syntax.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index ca66e2110..c49cd3648 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -505,9 +505,18 @@ void Type::accept(IValVisitor* visitor, void* extra) if (aggTypeDeclRef.getDecl()->memberDictionary.TryGetValue(assocTypeDecl->getName(), targetType)) { if (auto typeDefDecl = dynamic_cast<TypeDefDecl*>(targetType)) - return typeDefDecl->type.type; + { + DeclRef<TypeDefDecl> targetTypeDeclRef(typeDefDecl, aggTypeDeclRef.substitutions); + return GetType(targetTypeDeclRef); + } + else if (auto targetAggType = dynamic_cast<AggTypeDecl*>(targetType)) + { + return DeclRefType::Create(getSession(), DeclRef<Decl>(targetAggType, aggTypeDeclRef.substitutions)); + } else - return DeclRefType::Create(getSession(), DeclRef<Decl>(targetType, aggTypeDeclRef.substitutions)); + { + SLANG_UNIMPLEMENTED_X("unknown assoctype implementation type."); + } } } } |
