mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Add infer tuple test
This commit is contained in:
parent
0199572a3d
commit
829f668bd7
2 changed files with 17 additions and 0 deletions
|
@ -268,6 +268,18 @@ fn test(a: A) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn infer_tuple() {
|
||||||
|
check_inference(
|
||||||
|
r#"
|
||||||
|
fn test() {
|
||||||
|
let a: (u32, &str) = (1, "a");
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
"tuple.txt",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn infer(content: &str) -> String {
|
fn infer(content: &str) -> String {
|
||||||
let (db, _, file_id) = MockDatabase::with_single_file(content);
|
let (db, _, file_id) = MockDatabase::with_single_file(content);
|
||||||
let source_file = db.source_file(file_id);
|
let source_file = db.source_file(file_id);
|
||||||
|
|
5
crates/ra_hir/src/ty/tests/data/tuple.txt
Normal file
5
crates/ra_hir/src/ty/tests/data/tuple.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[11; 49) '{ ...a"); }': ()
|
||||||
|
[21; 22) 'a': (u32, &str)
|
||||||
|
[38; 46) '(1, "a")': (u32, &str)
|
||||||
|
[39; 40) '1': u32
|
||||||
|
[42; 45) '"a"': &str
|
Loading…
Add table
Add a link
Reference in a new issue