File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 22 * Provides classes for recognizing type inference inconsistencies.
33 */
44
5+ private import Type
6+ private import TypeMention
57import TypeInference:: Consistency
8+
9+ int getTypeInferenceInconsistencyCounts ( string type ) {
10+ type = "Missing type parameter ID" and
11+ result = count ( TypeParameter tp | missingTypeParameterId ( tp ) | tp )
12+ or
13+ type = "Non-functional type parameter ID" and
14+ result = count ( TypeParameter tp | nonFunctionalTypeParameterId ( tp ) | tp )
15+ or
16+ type = "Non-injective type parameter ID" and
17+ result = count ( TypeParameter tp | nonInjectiveTypeParameterId ( tp , _) | tp )
18+ or
19+ type = "Ill-formed type mention" and
20+ result = count ( TypeMention tm | illFormedTypeMention ( tm ) | tm )
21+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ private import codeql.rust.dataflow.internal.DataFlowImpl
88private import codeql.rust.dataflow.internal.TaintTrackingImpl
99private import codeql.rust.internal.AstConsistency as AstConsistency
1010private import codeql.rust.internal.PathResolutionConsistency as PathResolutionConsistency
11+ private import codeql.rust.internal.TypeInferenceConsistency as TypeInferenceConsistency
1112private import codeql.rust.controlflow.internal.CfgConsistency as CfgConsistency
1213private import codeql.rust.dataflow.internal.DataFlowConsistency as DataFlowConsistency
1314private import codeql.rust.dataflow.internal.SsaImpl:: Consistency as SsaConsistency
@@ -52,6 +53,13 @@ int getTotalPathResolutionInconsistencies() {
5253 sum ( string type | | PathResolutionConsistency:: getPathResolutionInconsistencyCounts ( type ) )
5354}
5455
56+ /**
57+ * Gets a count of the total number of type inference inconsistencies in the database.
58+ */
59+ int getTotalTypeInferenceInconsistencies ( ) {
60+ result = sum ( string type | | TypeInferenceConsistency:: getTypeInferenceInconsistencyCounts ( type ) )
61+ }
62+
5563/**
5664 * Gets a count of the total number of control flow graph inconsistencies in the database.
5765 */
@@ -156,7 +164,9 @@ predicate inconsistencyStats(string key, int value) {
156164 or
157165 key = "Inconsistencies - SSA" and value = getTotalSsaInconsistencies ( )
158166 or
159- key = "Inconsistencies - data flow" and value = getTotalDataFlowInconsistencies ( )
167+ key = "Inconsistencies - Data flow" and value = getTotalDataFlowInconsistencies ( )
168+ or
169+ key = "Inconsistencies - Type inference" and value = getTotalTypeInferenceInconsistencies ( )
160170}
161171
162172/**
You can’t perform that action at this time.
0 commit comments