diff options
author | Florian Diebold <[email protected]> | 2020-06-19 15:29:38 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-06-19 20:46:47 +0100 |
commit | 2745cb37c16600c99083cefdf5eb45a5205dd86d (patch) | |
tree | 518fe5b3895e021e1d35e90d6e7d71abfc36692a /crates/ra_hir_ty/src/tests/regression.rs | |
parent | 6654055308515cb330f23942f347de5605f69be1 (diff) |
Use correct substs for super trait assoc types
When referring to an associated type of a super trait, we used the substs of the
subtrait. That led to the #4931 crash if the subtrait had less parameters, but
it could also lead to other incorrectness if just the order was different.
Fixes #4931.
Diffstat (limited to 'crates/ra_hir_ty/src/tests/regression.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests/regression.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs index ed43df484..8dc5603b7 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/ra_hir_ty/src/tests/regression.rs | |||
@@ -665,3 +665,31 @@ impl Foo<i64> { | |||
665 | "### | 665 | "### |
666 | ); | 666 | ); |
667 | } | 667 | } |
668 | |||
669 | #[test] | ||
670 | fn issue_4931() { | ||
671 | assert_snapshot!( | ||
672 | infer(r#" | ||
673 | trait Div<T> { | ||
674 | type Output; | ||
675 | } | ||
676 | |||
677 | trait CheckedDiv: Div<()> {} | ||
678 | |||
679 | trait PrimInt: CheckedDiv<Output = ()> { | ||
680 | fn pow(self); | ||
681 | } | ||
682 | |||
683 | fn check<T: PrimInt>(i: T) { | ||
684 | i.pow(); | ||
685 | } | ||
686 | "#), | ||
687 | @r###" | ||
688 | 118..122 'self': Self | ||
689 | 149..150 'i': T | ||
690 | 155..171 '{ ...w(); }': () | ||
691 | 161..162 'i': T | ||
692 | 161..168 'i.pow()': () | ||
693 | "### | ||
694 | ); | ||
695 | } | ||