aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-10-30 20:22:46 +0000
committerFlorian Diebold <[email protected]>2019-11-01 18:57:08 +0000
commit7b7133ec58818894d3d56df021ae70159e2c3252 (patch)
treedbc2a07b8d0d5167a50c620f491564201612adc3 /crates
parent44279ef1df49585d0b151dcfb5cefade012dbc7a (diff)
Insert type vars before doing assoc item resolution
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/ty/infer/path.rs3
-rw-r--r--crates/ra_hir/src/ty/tests.rs24
2 files changed, 15 insertions, 12 deletions
diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs
index 885588174..0cde77265 100644
--- a/crates/ra_hir/src/ty/infer/path.rs
+++ b/crates/ra_hir/src/ty/infer/path.rs
@@ -124,6 +124,9 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
124 return None; 124 return None;
125 } 125 }
126 126
127 let ty = self.insert_type_vars(ty);
128 let ty = self.normalize_associated_types_in(ty);
129
127 let segment = 130 let segment =
128 remaining_segments.last().expect("there should be at least one segment here"); 131 remaining_segments.last().expect("there should be at least one segment here");
129 132
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 3af926279..e071e4d4e 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -2879,9 +2879,9 @@ fn test() {
2879"#), 2879"#),
2880 @r###" 2880 @r###"
2881 [101; 127) '{ ...e(); }': () 2881 [101; 127) '{ ...e(); }': ()
2882 [111; 112) 'a': {unknown} 2882 [111; 112) 'a': (S<i32>, i64)
2883 [115; 122) 'S::make': {unknown} 2883 [115; 122) 'S::make': fn make<S<i32>, i64>() -> (Self, T)
2884 [115; 124) 'S::make()': {unknown} 2884 [115; 124) 'S::make()': (S<i32>, i64)
2885 "### 2885 "###
2886 ); 2886 );
2887} 2887}
@@ -2897,18 +2897,18 @@ struct S<T>;
2897impl Trait<i64> for S<u64> {} 2897impl Trait<i64> for S<u64> {}
2898impl Trait<i32> for S<u32> {} 2898impl Trait<i32> for S<u32> {}
2899fn test() { 2899fn test() {
2900 let a: (Self<i64>, _) = S::make(); 2900 let a: (S<u64>, _) = S::make();
2901 let b: (_, u32) = S::make(); 2901 let b: (_, i32) = S::make();
2902} 2902}
2903"#), 2903"#),
2904 @r###" 2904 @r###"
2905 [131; 206) '{ ...e(); }': () 2905 [131; 203) '{ ...e(); }': ()
2906 [141; 142) 'a': ({unknown}, {unknown}) 2906 [141; 142) 'a': (S<u64>, i64)
2907 [161; 168) 'S::make': {unknown} 2907 [158; 165) 'S::make': fn make<S<u64>, i64>() -> (Self, T)
2908 [161; 170) 'S::make()': ({unknown}, {unknown}) 2908 [158; 167) 'S::make()': (S<u64>, i64)
2909 [180; 181) 'b': ({unknown}, u32) 2909 [177; 178) 'b': (S<u32>, i32)
2910 [194; 201) 'S::make': {unknown} 2910 [191; 198) 'S::make': fn make<S<u32>, i32>() -> (Self, T)
2911 [194; 203) 'S::make()': ({unknown}, u32) 2911 [191; 200) 'S::make()': (S<u32>, i32)
2912 "### 2912 "###
2913 ); 2913 );
2914} 2914}