[AST] Preserve type sugar for generic typealiases#15416
Merged
DougGregor merged 3 commits intoswiftlang:masterfrom Mar 22, 2018
Merged
[AST] Preserve type sugar for generic typealiases#15416DougGregor merged 3 commits intoswiftlang:masterfrom
DougGregor merged 3 commits intoswiftlang:masterfrom
Conversation
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.
… contexts Currently, when we reference a (non-generic) typealias within a generic context, we would completely lose type sugar for the typealias, replacing it with the underlying type. Instead, use BoundNameAliasType for this purpose, which allows us to maintain all of the type sugar as well as storing complete substitutions for later use.
611905a to
253bd10
Compare
Member
Author
|
@swift-ci please test |
1 similar comment
Member
Author
|
@swift-ci please test |
Contributor
|
Build failed |
Member
Author
|
@swift-ci please test source compatibility |
Member
Author
|
@swift-ci please smoke test Linux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a new
Typenode,BoundNameAliasType, which describes a reference to atypealiasthat 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
NameAliasTypein the future.