Skip to content

Commit fd59a27

Browse files
committed
Rust: Add macro expr type inference test
1 parent ad64e04 commit fd59a27

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

rust/ql/test/library-tests/type-inference/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,12 @@ mod indexers {
18101810
}
18111811
}
18121812

1813+
mod macros {
1814+
pub fn f() {
1815+
let x = format!("Hello, {}", "World!"); // $ MISSING: type=x:String
1816+
}
1817+
}
1818+
18131819
fn main() {
18141820
field_access::f();
18151821
method_impl::f();
@@ -1832,4 +1838,5 @@ fn main() {
18321838
async_::f();
18331839
impl_trait::f();
18341840
indexers::f();
1841+
macros::f();
18351842
}

rust/ql/test/library-tests/type-inference/type-inference.expected

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,9 +2642,13 @@ inferType
26422642
| main.rs:1809:24:1809:25 | xs | | file://:0:0:0:0 | [] |
26432643
| main.rs:1809:24:1809:25 | xs | [T;...] | main.rs:1764:5:1765:13 | S |
26442644
| main.rs:1809:24:1809:25 | xs | [T] | main.rs:1764:5:1765:13 | S |
2645-
| main.rs:1815:5:1815:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
2646-
| main.rs:1816:5:1816:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
2647-
| main.rs:1816:20:1816:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2648-
| main.rs:1816:41:1816:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2649-
| main.rs:1832:5:1832:15 | ...::f(...) | | {EXTERNAL LOCATION} | trait Future |
2645+
| main.rs:1815:25:1815:35 | "Hello, {}" | | {EXTERNAL LOCATION} | str |
2646+
| main.rs:1815:25:1815:45 | ...::format(...) | | {EXTERNAL LOCATION} | String |
2647+
| main.rs:1815:25:1815:45 | { ... } | | {EXTERNAL LOCATION} | String |
2648+
| main.rs:1815:38:1815:45 | "World!" | | {EXTERNAL LOCATION} | str |
2649+
| main.rs:1821:5:1821:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
2650+
| main.rs:1822:5:1822:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
2651+
| main.rs:1822:20:1822:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2652+
| main.rs:1822:41:1822:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2653+
| main.rs:1838:5:1838:15 | ...::f(...) | | {EXTERNAL LOCATION} | trait Future |
26502654
testFailures

0 commit comments

Comments
 (0)