mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: Include certain types in type inference tests
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4,15 +4,25 @@ import codeql.rust.internal.Type
|
||||
import codeql.rust.internal.TypeInference as TypeInference
|
||||
import TypeInference
|
||||
|
||||
query predicate inferType(AstNode n, TypePath path, Type t) {
|
||||
t = TypeInference::inferType(n, path) and
|
||||
t != TUnknownType() and
|
||||
private predicate relevantNode(AstNode n) {
|
||||
n.fromSource() and
|
||||
not n.isFromMacroExpansion() and
|
||||
not n instanceof IdentPat and // avoid overlap in the output with the underlying `Name` node
|
||||
not n instanceof LiteralPat // avoid overlap in the output with the underlying `Literal` node
|
||||
}
|
||||
|
||||
query predicate inferCertainType(AstNode n, TypePath path, Type t) {
|
||||
t = TypeInference::CertainTypeInference::inferCertainType(n, path) and
|
||||
t != TUnknownType() and
|
||||
relevantNode(n)
|
||||
}
|
||||
|
||||
query predicate inferType(AstNode n, TypePath path, Type t) {
|
||||
t = TypeInference::inferType(n, path) and
|
||||
t != TUnknownType() and
|
||||
relevantNode(n)
|
||||
}
|
||||
|
||||
module ResolveTest implements TestSig {
|
||||
string getARelevantTag() { result = ["target", "fieldof"] }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user