Swift: collapse TypeRepr
hierarchy
#9805
Merged
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.
Now
TypeRepr
is a final class in the AST, which is more or less justa type with a location in code.
As the frontend does not provide a direct way to get a type from a
type representation, this information must be provided when fetching
the label of a type repr.
This meant:
EnumIsCaseExpr
: this is a virtualAST node introduced in place of some kinds of
IsEpxr
. The typerepr is still available from the
ConditionalCheckedCastExpr
wrappedby this virtual node, and we will rebuild the original
IsExpr
withthe IPA layer.
KeyPathExpr
. This was done to keep theTypeRepr
toType
relationtotal in the DB, but goes against the design of a dumb extractor. The
logic could be moved to QL in the future
TypeRepr
children are now ignored. Asfar as I can tell, there is no runtime evaluation going on in
TypeRepr
s, so it does not make much sense to have control flowthrough them.
swift::ASTNode
, we cannot do it forTypeRepr
,and we just skip fetching in that case (leading to an assertion). This behaviour
relies on the fact that we only extract
swift::ASTNode
in the context ofBraceStmt
, where a standaloneTypeRepr
is actually impossibleWe should probably decouple
AstNode
from what can appear in aBraceStmt
.