diff options
author | Florian Diebold <[email protected]> | 2020-05-29 18:14:04 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-06-05 19:09:13 +0100 |
commit | a4a4a1854ebb53e1cdd7a5e3b308112bbbf3c676 (patch) | |
tree | 343d39c2a01bd3643bcab13eb01dfbd4f6a511cc /crates/ra_hir_ty/src/infer.rs | |
parent | 02f7b5d7abbab829c2a0f66cdcbb6678afb412a4 (diff) |
Fix type parameter defaults
They should not be applied in expression or pattern contexts, unless there are
other explicitly given type args.
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) |