Skip to content

Commit 9e4b644

Browse files
committed
Rust: Add type inference debug predicates
1 parent ba22364 commit 9e4b644

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,3 +1035,24 @@ import Cached
10351035
* Gets a type that `n` infers to, if any.
10361036
*/
10371037
Type inferType(AstNode n) { result = inferType(n, TypePath::nil()) }
1038+
1039+
/** Provides predicates for debugging the type inference implementation. */
1040+
private module Debug {
1041+
private Locatable getRelevantLocatable() {
1042+
exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
1043+
result.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) and
1044+
filepath.matches("%/tauri/src/app/plugin.rs") and
1045+
startline = 54
1046+
)
1047+
}
1048+
1049+
Type debugInferType(AstNode n, TypePath path) {
1050+
n = getRelevantLocatable() and
1051+
result = inferType(n, path)
1052+
}
1053+
1054+
Function debugResolveMethodCallExpr(MethodCallExpr mce) {
1055+
mce = getRelevantLocatable() and
1056+
result = resolveMethodCallExpr(mce)
1057+
}
1058+
}

0 commit comments

Comments
 (0)