Skip to content

Commit 302680c

Browse files
authored
Merge pull request #19425 from hvitved/rust/type-inference-debug-predicates
Rust: Add type inference debug predicates
2 parents c8e564b + 4f5b340 commit 302680c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

rust/ql/lib/codeql/rust/internal/TypeInference.qll

+21
Original file line numberDiff line numberDiff line change
@@ -1017,3 +1017,24 @@ import Cached
10171017
* Gets a type that `n` infers to, if any.
10181018
*/
10191019
Type inferType(AstNode n) { result = inferType(n, TypePath::nil()) }
1020+
1021+
/** Provides predicates for debugging the type inference implementation. */
1022+
private module Debug {
1023+
private Locatable getRelevantLocatable() {
1024+
exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
1025+
result.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) and
1026+
filepath.matches("%/tauri/src/app/plugin.rs") and
1027+
startline = 54
1028+
)
1029+
}
1030+
1031+
Type debugInferType(AstNode n, TypePath path) {
1032+
n = getRelevantLocatable() and
1033+
result = inferType(n, path)
1034+
}
1035+
1036+
Function debugResolveMethodCallExpr(MethodCallExpr mce) {
1037+
mce = getRelevantLocatable() and
1038+
result = resolveMethodCallExpr(mce)
1039+
}
1040+
}

0 commit comments

Comments
 (0)