mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Rust: Infer certain types for logical operators
This commit is contained in:
@@ -383,6 +383,8 @@ private module CertainTypeInference {
|
||||
result = inferRefNodeType(n) and
|
||||
path.isEmpty()
|
||||
or
|
||||
result = inferLogicalOperationType(n, path)
|
||||
or
|
||||
result = inferTupleRootType(n) and
|
||||
path.isEmpty()
|
||||
or
|
||||
@@ -440,11 +442,10 @@ private module CertainTypeInference {
|
||||
}
|
||||
|
||||
private Type inferLogicalOperationType(AstNode n, TypePath path) {
|
||||
exists(Builtins::BuiltinType t, BinaryLogicalOperation be |
|
||||
exists(Builtins::Bool t, BinaryLogicalOperation be |
|
||||
n = [be, be.getLhs(), be.getRhs()] and
|
||||
path.isEmpty() and
|
||||
result = TStruct(t) and
|
||||
t instanceof Builtins::Bool
|
||||
result = TStruct(t)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2381,8 +2382,6 @@ private module Cached {
|
||||
(
|
||||
result = inferAnnotatedType(n, path)
|
||||
or
|
||||
result = inferLogicalOperationType(n, path)
|
||||
or
|
||||
result = inferAssignmentOperationType(n, path)
|
||||
or
|
||||
result = inferTypeEquality(n, path)
|
||||
|
||||
Reference in New Issue
Block a user