Skip to content

Commit f6eca1d

Browse files
committed
Rust: Add macro expr type inference test
1 parent 55eb9fb commit f6eca1d

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
@@ -1805,6 +1805,12 @@ mod indexers {
18051805
}
18061806
}
18071807

1808+
mod macros {
1809+
pub fn f() {
1810+
let x = format!("Hello, {}", "World!"); // $ MISSING: type=x:String
1811+
}
1812+
}
1813+
18081814
fn main() {
18091815
field_access::f();
18101816
method_impl::f();
@@ -1827,4 +1833,5 @@ fn main() {
18271833
async_::f();
18281834
impl_trait::f();
18291835
indexers::f();
1836+
macros::f();
18301837
}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,9 +2634,13 @@ inferType
26342634
| main.rs:1804:24:1804:25 | xs | | file://:0:0:0:0 | [] |
26352635
| main.rs:1804:24:1804:25 | xs | [T;...] | main.rs:1759:5:1760:13 | S |
26362636
| main.rs:1804:24:1804:25 | xs | [T] | main.rs:1759:5:1760:13 | S |
2637-
| main.rs:1810:5:1810:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
2638-
| main.rs:1811:5:1811:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
2639-
| main.rs:1811:20:1811:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2640-
| main.rs:1811:41:1811:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2641-
| main.rs:1827:5:1827:15 | ...::f(...) | | {EXTERNAL LOCATION} | trait Future |
2637+
| main.rs:1810:25:1810:35 | "Hello, {}" | | {EXTERNAL LOCATION} | str |
2638+
| main.rs:1810:25:1810:45 | ...::format(...) | | {EXTERNAL LOCATION} | String |
2639+
| main.rs:1810:25:1810:45 | { ... } | | {EXTERNAL LOCATION} | String |
2640+
| main.rs:1810:38:1810:45 | "World!" | | {EXTERNAL LOCATION} | str |
2641+
| main.rs:1816:5:1816:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
2642+
| main.rs:1817:5:1817:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
2643+
| main.rs:1817:20:1817:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2644+
| main.rs:1817:41:1817:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
2645+
| main.rs:1833:5:1833:15 | ...::f(...) | | {EXTERNAL LOCATION} | trait Future |
26422646
testFailures

0 commit comments

Comments
 (0)