From 6fcd38cc81bdcc9921da767872dfce65ee7d2d27 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 24 Dec 2018 21:00:14 +0100 Subject: Infer result of struct literals, and recurse into their child expressions --- crates/ra_hir/src/ty/tests.rs | 2 +- crates/ra_hir/src/ty/tests/data/0004_struct.txt | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 170eef147..9bb58ec85 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -82,7 +82,7 @@ struct C(usize); fn test() { let c = C(1); B; - let a: A = A { b: B, c: C() }; + let a: A = A { b: B, c: C(1) }; a.b; a.c; } diff --git a/crates/ra_hir/src/ty/tests/data/0004_struct.txt b/crates/ra_hir/src/ty/tests/data/0004_struct.txt index a4371c5a5..41357749f 100644 --- a/crates/ra_hir/src/ty/tests/data/0004_struct.txt +++ b/crates/ra_hir/src/ty/tests/data/0004_struct.txt @@ -1,10 +1,14 @@ [86; 90) 'C(1)': [unknown] -[72; 153) '{ ...a.c; }': () +[121; 122) 'B': [unknown] [86; 87) 'C': [unknown] +[129; 130) '1': [unknown] [107; 108) 'a': A -[114; 132) 'A { b:... C() }': [unknown] -[138; 141) 'a.b': [unknown] -[147; 150) 'a.c': [unknown] +[127; 128) 'C': [unknown] +[139; 142) 'a.b': [unknown] +[114; 133) 'A { b:...C(1) }': A +[148; 151) 'a.c': [unknown] +[72; 154) '{ ...a.c; }': () [96; 97) 'B': [unknown] [88; 89) '1': [unknown] [82; 83) 'c': [unknown] +[127; 131) 'C(1)': [unknown] -- cgit v1.2.3