-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust: Only include relevant AST nodes in TypeMention #19557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust: Only include relevant AST nodes in TypeMention #19557
Conversation
@@ -0,0 +1,2 @@ | |||
illFormedTypeMention | |||
| main.rs:403:18:403:24 | FuncPtr | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This inconsistency is a path to a function pointer type, which doesn't have a type as we don't support function pointers types.
DCA seems fine though I don't really understand the result.
|
They would have to be added here, and then we would also have to add a new report to DCA. |
Thanks. I've added type inference inconsistencies to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but some tests are failing.
a627277
to
5e4576b
Compare
3099d3d
to
0023122
Compare
Now the CI is (finally) happy. I removed type inference inconsistencies from the reduced summary stats and also suppressed inconsistencies in library code. |
@@ -156,7 +164,14 @@ predicate inconsistencyStats(string key, int value) { | |||
or | |||
key = "Inconsistencies - SSA" and value = getTotalSsaInconsistencies() | |||
or | |||
key = "Inconsistencies - data flow" and value = getTotalDataFlowInconsistencies() | |||
key = "Inconsistencies - Data flow" and value = getTotalDataFlowInconsistencies() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require an internal change in the DCA report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh 😭 I'll revert it.
0023122
to
6313703
Compare
6313703
to
5228062
Compare
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.