diff options
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 13 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 22 |
2 files changed, 21 insertions, 14 deletions
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index 60c7fd0e5..68c2f0b06 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -909,9 +909,16 @@ impl HirDisplay for ApplicationTy { | |||
909 | } | 909 | } |
910 | } | 910 | } |
911 | if self.parameters.len() > 0 { | 911 | if self.parameters.len() > 0 { |
912 | write!(f, "<")?; | 912 | let generics = generics(f.db, def.into()); |
913 | f.write_joined(&*self.parameters.0, ", ")?; | 913 | let (parent_params, self_param, type_params, _impl_trait_params) = |
914 | write!(f, ">")?; | 914 | generics.provenance_split(); |
915 | let total_len = parent_params + self_param + type_params; | ||
916 | // We print all params except implicit impl Trait params. Still a bit weird; should we leave out parent and self? | ||
917 | if total_len > 0 { | ||
918 | write!(f, "<")?; | ||
919 | f.write_joined(&self.parameters.0[..total_len], ", ")?; | ||
920 | write!(f, ">")?; | ||
921 | } | ||
915 | } | 922 | } |
916 | write!(f, "(")?; | 923 | write!(f, "(")?; |
917 | f.write_joined(sig.params(), ", ")?; | 924 | f.write_joined(sig.params(), ", ")?; |
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index f90dadc08..c6851fb69 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -886,7 +886,7 @@ fn test(x: impl Trait<u64>, y: &impl Trait<u32>) { | |||
886 | [224; 225) 'S': S<u16>(u16) -> S<u16> | 886 | [224; 225) 'S': S<u16>(u16) -> S<u16> |
887 | [224; 228) 'S(1)': S<u16> | 887 | [224; 228) 'S(1)': S<u16> |
888 | [226; 227) '1': u16 | 888 | [226; 227) '1': u16 |
889 | [234; 237) 'bar': fn bar<S<u16>>(S<u16>) -> () | 889 | [234; 237) 'bar': fn bar(S<u16>) -> () |
890 | [234; 240) 'bar(z)': () | 890 | [234; 240) 'bar(z)': () |
891 | [238; 239) 'z': S<u16> | 891 | [238; 239) 'z': S<u16> |
892 | [246; 247) 'x': impl Trait<u64> | 892 | [246; 247) 'x': impl Trait<u64> |
@@ -943,28 +943,28 @@ fn test() { | |||
943 | [222; 229) 'loop {}': ! | 943 | [222; 229) 'loop {}': ! |
944 | [227; 229) '{}': () | 944 | [227; 229) '{}': () |
945 | [301; 510) '{ ... i32 }': () | 945 | [301; 510) '{ ... i32 }': () |
946 | [307; 315) 'Foo::bar': fn bar<{unknown}, {unknown}, S>(S) -> {unknown} | 946 | [307; 315) 'Foo::bar': fn bar<{unknown}, {unknown}>(S) -> {unknown} |
947 | [307; 318) 'Foo::bar(S)': {unknown} | 947 | [307; 318) 'Foo::bar(S)': {unknown} |
948 | [316; 317) 'S': S | 948 | [316; 317) 'S': S |
949 | [324; 339) '<F as Foo>::bar': fn bar<F, {unknown}, S>(S) -> {unknown} | 949 | [324; 339) '<F as Foo>::bar': fn bar<F, {unknown}>(S) -> {unknown} |
950 | [324; 342) '<F as ...bar(S)': {unknown} | 950 | [324; 342) '<F as ...bar(S)': {unknown} |
951 | [340; 341) 'S': S | 951 | [340; 341) 'S': S |
952 | [348; 354) 'F::bar': fn bar<F, {unknown}, S>(S) -> {unknown} | 952 | [348; 354) 'F::bar': fn bar<F, {unknown}>(S) -> {unknown} |
953 | [348; 357) 'F::bar(S)': {unknown} | 953 | [348; 357) 'F::bar(S)': {unknown} |
954 | [355; 356) 'S': S | 954 | [355; 356) 'S': S |
955 | [363; 378) 'Foo::bar::<u32>': fn bar<{unknown}, u32, S>(S) -> u32 | 955 | [363; 378) 'Foo::bar::<u32>': fn bar<{unknown}, u32>(S) -> u32 |
956 | [363; 381) 'Foo::b...32>(S)': u32 | 956 | [363; 381) 'Foo::b...32>(S)': u32 |
957 | [379; 380) 'S': S | 957 | [379; 380) 'S': S |
958 | [387; 409) '<F as ...:<u32>': fn bar<F, u32, S>(S) -> u32 | 958 | [387; 409) '<F as ...:<u32>': fn bar<F, u32>(S) -> u32 |
959 | [387; 412) '<F as ...32>(S)': u32 | 959 | [387; 412) '<F as ...32>(S)': u32 |
960 | [410; 411) 'S': S | 960 | [410; 411) 'S': S |
961 | [419; 422) 'foo': fn foo<{unknown}, S>(S) -> {unknown} | 961 | [419; 422) 'foo': fn foo<{unknown}>(S) -> {unknown} |
962 | [419; 425) 'foo(S)': {unknown} | 962 | [419; 425) 'foo(S)': {unknown} |
963 | [423; 424) 'S': S | 963 | [423; 424) 'S': S |
964 | [431; 441) 'foo::<u32>': fn foo<u32, S>(S) -> u32 | 964 | [431; 441) 'foo::<u32>': fn foo<u32>(S) -> u32 |
965 | [431; 444) 'foo::<u32>(S)': u32 | 965 | [431; 444) 'foo::<u32>(S)': u32 |
966 | [442; 443) 'S': S | 966 | [442; 443) 'S': S |
967 | [450; 465) 'foo::<u32, i32>': fn foo<u32, S>(S) -> u32 | 967 | [450; 465) 'foo::<u32, i32>': fn foo<u32>(S) -> u32 |
968 | [450; 468) 'foo::<...32>(S)': u32 | 968 | [450; 468) 'foo::<...32>(S)': u32 |
969 | [466; 467) 'S': S | 969 | [466; 467) 'S': S |
970 | "### | 970 | "### |
@@ -1794,11 +1794,11 @@ fn test() -> impl Trait<i32> { | |||
1794 | [229; 241) 'S(default())': S<u32> | 1794 | [229; 241) 'S(default())': S<u32> |
1795 | [231; 238) 'default': fn default<u32>() -> u32 | 1795 | [231; 238) 'default': fn default<u32>() -> u32 |
1796 | [231; 240) 'default()': u32 | 1796 | [231; 240) 'default()': u32 |
1797 | [247; 250) 'foo': fn foo<S<u32>>(S<u32>) -> () | 1797 | [247; 250) 'foo': fn foo(S<u32>) -> () |
1798 | [247; 254) 'foo(s1)': () | 1798 | [247; 254) 'foo(s1)': () |
1799 | [251; 253) 's1': S<u32> | 1799 | [251; 253) 's1': S<u32> |
1800 | [264; 265) 'x': i32 | 1800 | [264; 265) 'x': i32 |
1801 | [273; 276) 'bar': fn bar<i32, S<i32>>(S<i32>) -> i32 | 1801 | [273; 276) 'bar': fn bar<i32>(S<i32>) -> i32 |
1802 | [273; 290) 'bar(S(...lt()))': i32 | 1802 | [273; 290) 'bar(S(...lt()))': i32 |
1803 | [277; 278) 'S': S<i32>(i32) -> S<i32> | 1803 | [277; 278) 'S': S<i32>(i32) -> S<i32> |
1804 | [277; 289) 'S(default())': S<i32> | 1804 | [277; 289) 'S(default())': S<i32> |