Rust: Add type inference debug predicates

This commit is contained in:
Tom Hvitved
2025-04-30 15:12:58 +02:00
parent 389f15e670
commit 4f5b340278

View File

@@ -1017,3 +1017,24 @@ import Cached
* Gets a type that `n` infers to, if any.
*/
Type inferType(AstNode n) { result = inferType(n, TypePath::nil()) }
/** Provides predicates for debugging the type inference implementation. */
private module Debug {
private Locatable getRelevantLocatable() {
exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
result.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) and
filepath.matches("%/tauri/src/app/plugin.rs") and
startline = 54
)
}
Type debugInferType(AstNode n, TypePath path) {
n = getRelevantLocatable() and
result = inferType(n, path)
}
Function debugResolveMethodCallExpr(MethodCallExpr mce) {
mce = getRelevantLocatable() and
result = resolveMethodCallExpr(mce)
}
}