[AST] Preserve type sugar for generic typealiases

Introduce a new Type node, BoundNameAliasType, which describes a
reference to a typealias that requires substitutions to produce the
underlying type. This new type node is used both for references to
generic typealiases and for references to (non-generic) typealiases
that occur within generic contexts, e.g., Array<Int>.Element.

At present, the new type node is mainly useful in preserving type
sugar for diagnostics purposes, as well as being reflected in other
tools (indexing, code completion, etc.). The intent is to completely
replace NameAliasType in the future.
This commit is contained in:
Doug Gregor
2018-03-21 18:34:18 -07:00
parent 334c0248ed
commit 80eae200b6
22 changed files with 434 additions and 19 deletions

View File

@@ -647,6 +647,14 @@ namespace decls_block {
TypeIDField // canonical type (a fallback)
>;
using BoundNameAliasTypeLayout = BCRecordLayout<
BOUND_NAME_ALIAS_TYPE,
DeclIDField, // typealias decl
TypeIDField, // parent type
TypeIDField // underlying type
// trailing substitutions
>;
using GenericTypeParamTypeLayout = BCRecordLayout<
GENERIC_TYPE_PARAM_TYPE,
DeclIDField, // generic type parameter decl or depth