mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
Rust: Add type inference tests for operators
This commit is contained in:
@@ -1224,6 +1224,21 @@ mod builtins {
|
||||
}
|
||||
}
|
||||
|
||||
mod operators {
|
||||
pub fn f() {
|
||||
let x = true && false; // $ MISSING: type=x:bool
|
||||
let y = true || false; // $ MISSING: type=y:bool
|
||||
|
||||
let mut a;
|
||||
if 34 == 33 {
|
||||
let z = (a = 1); // $ MISSING: type=z:() MISSING: type=a:i32
|
||||
} else {
|
||||
a = 2; // $ MISSING: type=a:i32
|
||||
}
|
||||
a; // $ MISSING: type=a:i32
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
field_access::f();
|
||||
method_impl::f();
|
||||
@@ -1242,4 +1257,5 @@ fn main() {
|
||||
borrowed_typed::f();
|
||||
try_expressions::f();
|
||||
builtins::f();
|
||||
operators::f();
|
||||
}
|
||||
|
||||
@@ -1581,7 +1581,15 @@ inferType
|
||||
| main.rs:1222:17:1222:20 | true | | file:///BUILTINS/types.rs:3:1:5:16 | bool |
|
||||
| main.rs:1223:13:1223:13 | f | | file:///BUILTINS/types.rs:3:1:5:16 | bool |
|
||||
| main.rs:1223:17:1223:21 | false | | file:///BUILTINS/types.rs:3:1:5:16 | bool |
|
||||
| main.rs:1229:5:1229:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1230:5:1230:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1230:20:1230:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1230:41:1230:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1229:17:1229:20 | true | | file:///BUILTINS/types.rs:3:1:5:16 | bool |
|
||||
| main.rs:1229:25:1229:29 | false | | file:///BUILTINS/types.rs:3:1:5:16 | bool |
|
||||
| main.rs:1230:17:1230:20 | true | | file:///BUILTINS/types.rs:3:1:5:16 | bool |
|
||||
| main.rs:1230:25:1230:29 | false | | file:///BUILTINS/types.rs:3:1:5:16 | bool |
|
||||
| main.rs:1233:12:1233:13 | 34 | | file:///BUILTINS/types.rs:12:1:12:15 | i32 |
|
||||
| main.rs:1233:18:1233:19 | 33 | | file:///BUILTINS/types.rs:12:1:12:15 | i32 |
|
||||
| main.rs:1234:26:1234:26 | 1 | | file:///BUILTINS/types.rs:12:1:12:15 | i32 |
|
||||
| main.rs:1236:17:1236:17 | 2 | | file:///BUILTINS/types.rs:12:1:12:15 | i32 |
|
||||
| main.rs:1244:5:1244:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1245:5:1245:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1245:20:1245:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1245:41:1245:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
|
||||
Reference in New Issue
Block a user