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.rs | |
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.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index d9bf3c2f0..2e16e5120 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -439,13 +439,13 @@ impl<'a> InferenceContext<'a> { | |||
439 | }; | 439 | }; |
440 | return match resolution { | 440 | return match resolution { |
441 | TypeNs::AdtId(AdtId::StructId(strukt)) => { | 441 | TypeNs::AdtId(AdtId::StructId(strukt)) => { |
442 | let substs = Ty::substs_from_path(&ctx, path, strukt.into()); | 442 | let substs = Ty::substs_from_path(&ctx, path, strukt.into(), true); |
443 | let ty = self.db.ty(strukt.into()); | 443 | let ty = self.db.ty(strukt.into()); |
444 | let ty = self.insert_type_vars(ty.subst(&substs)); | 444 | let ty = self.insert_type_vars(ty.subst(&substs)); |
445 | forbid_unresolved_segments((ty, Some(strukt.into())), unresolved) | 445 | forbid_unresolved_segments((ty, Some(strukt.into())), unresolved) |
446 | } | 446 | } |
447 | TypeNs::EnumVariantId(var) => { | 447 | TypeNs::EnumVariantId(var) => { |
448 | let substs = Ty::substs_from_path(&ctx, path, var.into()); | 448 | let substs = Ty::substs_from_path(&ctx, path, var.into(), true); |
449 | let ty = self.db.ty(var.parent.into()); | 449 | let ty = self.db.ty(var.parent.into()); |
450 | let ty = self.insert_type_vars(ty.subst(&substs)); | 450 | let ty = self.insert_type_vars(ty.subst(&substs)); |
451 | forbid_unresolved_segments((ty, Some(var.into())), unresolved) | 451 | forbid_unresolved_segments((ty, Some(var.into())), unresolved) |