@@ -955,6 +955,97 @@ fn test() { foo.call(); }
955
955
) ;
956
956
}
957
957
958
+ #[ test]
959
+ fn super_trait_assoc_type_impl_return ( ) {
960
+ check_infer (
961
+ r#"
962
+ trait Base {
963
+ type Item;
964
+ fn foo(self) -> Self::Item;
965
+ }
966
+
967
+ trait Super : Base {}
968
+
969
+ fn base1() -> impl Base<Item = usize> { loop {} }
970
+ fn super1() -> impl Super<Item = usize> { loop {} }
971
+
972
+ fn test(base2: impl Base<Item = usize>, super2: impl Super<Item = usize>) {
973
+ base1().foo();
974
+ super1().foo();
975
+ base2.foo();
976
+ super2.foo();
977
+ }
978
+ "# ,
979
+ expect ! [ [ r#"
980
+ 39..43 'self': Self
981
+ 124..135 '{ loop {} }': !
982
+ 126..133 'loop {}': !
983
+ 131..133 '{}': ()
984
+ 176..187 '{ loop {} }': !
985
+ 178..185 'loop {}': !
986
+ 183..185 '{}': ()
987
+ 197..202 'base2': impl Base<Item = usize>
988
+ 229..235 'super2': impl Super<Item = usize>
989
+ 263..340 '{ ...o(); }': ()
990
+ 269..274 'base1': fn base1() -> impl Base<Item = usize>
991
+ 269..276 'base1()': impl Base<Item = usize>
992
+ 269..282 'base1().foo()': usize
993
+ 288..294 'super1': fn super1() -> impl Super<Item = usize>
994
+ 288..296 'super1()': impl Super<Item = usize>
995
+ 288..302 'super1().foo()': usize
996
+ 308..313 'base2': impl Base<Item = usize>
997
+ 308..319 'base2.foo()': usize
998
+ 325..331 'super2': impl Super<Item = usize>
999
+ 325..337 'super2.foo()': usize
1000
+ "# ] ] ,
1001
+ ) ;
1002
+ }
1003
+
1004
+ #[ test]
1005
+ fn super_trait_impl_return_trait_method_resolution ( ) {
1006
+ check_infer (
1007
+ r#"
1008
+ trait Base {
1009
+ fn foo(self) -> usize;
1010
+ }
1011
+
1012
+ trait Super : Base {}
1013
+
1014
+ fn base1() -> impl Base { loop {} }
1015
+ fn super1() -> impl Super { loop {} }
1016
+
1017
+ fn test(base2: impl Base, super2: impl Super) {
1018
+ base1().foo();
1019
+ super1().foo();
1020
+ base2.foo();
1021
+ super2.foo();
1022
+ }
1023
+ "# ,
1024
+ expect ! [ [ r#"
1025
+ 24..28 'self': Self
1026
+ 90..101 '{ loop {} }': !
1027
+ 92..99 'loop {}': !
1028
+ 97..99 '{}': ()
1029
+ 128..139 '{ loop {} }': !
1030
+ 130..137 'loop {}': !
1031
+ 135..137 '{}': ()
1032
+ 149..154 'base2': impl Base
1033
+ 167..173 'super2': impl Super
1034
+ 187..264 '{ ...o(); }': ()
1035
+ 193..198 'base1': fn base1() -> impl Base
1036
+ 193..200 'base1()': impl Base
1037
+ 193..206 'base1().foo()': usize
1038
+ 212..218 'super1': fn super1() -> impl Super
1039
+ 212..220 'super1()': impl Super
1040
+ 212..226 'super1().foo()': usize
1041
+ 232..237 'base2': impl Base
1042
+ 232..243 'base2.foo()': usize
1043
+ 249..255 'super2': impl Super
1044
+ 249..261 'super2.foo()': usize
1045
+ "# ] ] ,
1046
+ ) ;
1047
+ }
1048
+
958
1049
#[ test]
959
1050
fn method_resolution_non_parameter_type ( ) {
960
1051
check_types (
0 commit comments