Rust: Only include relevant AST nodes in TypeMention #19557
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.
At some point when quick eval'ing something I noticed that we have a lot of superfluous elements in
TypeMention
.This PR adds a basic consistency check for
TypeMention
s: that they have a type in the root. One could go further and check that the entire type tree corresponds to the types, but checking the root was enough at the moment to find interesting stuff.The biggest source of unnecessary
TypeMention
s was that we includePath
inTypeMention
, which also included all paths that are not types.A second inconsistency where paths where path resolution failed to find anything. These have now been excluded, as they don't do any good as
TypeMention
s anyway.There's still a lot of inconsistencies reported by the PR. One source is paths that resolve to a union, which don't have a type as we do not support unions.
On
rust
this PR reduces the number ofTypeMention
s from around 13 million to around 2 million.