Skip to content

Commit 41577b3

Browse files
committed
Test: add a little test case
1 parent a361eab commit 41577b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/Generics/inverse_generics.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,3 +500,11 @@ struct TestResolution3 {
500500
var dictNC: [String: NC] = [:] // expected-error {{type 'NC' does not conform to protocol 'Copyable'}}
501501
var exampleNC: Example<NC> = Example() // expected-error {{type 'NC' does not conform to protocol 'Copyable'}}
502502
}
503+
504+
public struct Box<Wrapped: ~Copyable>: ~Copyable {}
505+
// Box is never copyable, so we can't support this conditional conformance.
506+
public enum List<Element: ~Copyable>: ~Copyable {
507+
case cons(Element, Box<List<Element>>) // expected-error {{associated value 'cons' of 'Copyable'-conforming generic enum 'List' has non-Copyable type '(Element, Box<List<Element>>)'}}
508+
case empty
509+
}
510+
extension List: Copyable where Element: Copyable {}

0 commit comments

Comments
 (0)