diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-06 11:56:59 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-06 11:56:59 +0100 |
commit | a609336d7287b3ddddbde30b1f0fb606bf149baf (patch) | |
tree | 343d39c2a01bd3643bcab13eb01dfbd4f6a511cc /crates/ra_hir_ty/src/infer | |
parent | 02f7b5d7abbab829c2a0f66cdcbb6678afb412a4 (diff) | |
parent | a4a4a1854ebb53e1cdd7a5e3b308112bbbf3c676 (diff) |
Merge #4765
4765: Fix type parameter defaults r=matklad a=flodiebold
They should not be applied in expression or pattern contexts, unless there are other explicitly given type args.
(The existing tests about this were actually wrong.)
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/path.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/infer/path.rs b/crates/ra_hir_ty/src/infer/path.rs index 1c2e56fb0..1ad0d8397 100644 --- a/crates/ra_hir_ty/src/infer/path.rs +++ b/crates/ra_hir_ty/src/infer/path.rs | |||
@@ -95,7 +95,7 @@ impl<'a> InferenceContext<'a> { | |||
95 | // self_subst is just for the parent | 95 | // self_subst is just for the parent |
96 | let parent_substs = self_subst.unwrap_or_else(Substs::empty); | 96 | let parent_substs = self_subst.unwrap_or_else(Substs::empty); |
97 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); | 97 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); |
98 | let substs = Ty::substs_from_path(&ctx, path, typable); | 98 | let substs = Ty::substs_from_path(&ctx, path, typable, true); |
99 | let full_substs = Substs::builder(substs.len()) | 99 | let full_substs = Substs::builder(substs.len()) |
100 | .use_parent_substs(&parent_substs) | 100 | .use_parent_substs(&parent_substs) |
101 | .fill(substs.0[parent_substs.len()..].iter().cloned()) | 101 | .fill(substs.0[parent_substs.len()..].iter().cloned()) |
@@ -141,6 +141,7 @@ impl<'a> InferenceContext<'a> { | |||
141 | def, | 141 | def, |
142 | resolved_segment, | 142 | resolved_segment, |
143 | remaining_segments_for_ty, | 143 | remaining_segments_for_ty, |
144 | true, | ||
144 | ); | 145 | ); |
145 | if let Ty::Unknown = ty { | 146 | if let Ty::Unknown = ty { |
146 | return None; | 147 | return None; |