File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -942,3 +942,26 @@ do {
942
942
}
943
943
}
944
944
}
945
+
946
+ // https://github.com/apple/swift/issues/43527
947
+ do {
948
+ struct Box < Contents, U> { }
949
+
950
+ class Sweets { }
951
+ class Chocolate { }
952
+
953
+ struct Gift < Contents> {
954
+ // expected-note@-1 2 {{arguments to generic parameter 'Contents' ('Chocolate' and 'Sweets') are expected to be equal}}
955
+
956
+ init ( _: Box < [ Contents ] , Never > ) { }
957
+ }
958
+
959
+ let box = Box < [ Chocolate ] , Never > ( )
960
+
961
+ var g1 : Gift < Sweets >
962
+ g1 = Gift < Chocolate > ( box)
963
+ // expected-error@-1 {{cannot assign value of type 'Gift<Chocolate>' to type 'Gift<Sweets>'}}
964
+
965
+ let g2 : Gift < Sweets > = Gift < Chocolate > ( box)
966
+ // expected-error@-1 {{cannot assign value of type 'Gift<Chocolate>' to type 'Gift<Sweets>'}}
967
+ }
You can’t perform that action at this time.
0 commit comments