mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
'private' properties can't be accessed in extensions in Swift 3, so synthesizing a conformance that reads from such things is going to be incorrect in an extension.
26 lines
664 B
Swift
26 lines
664 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 4
|
|
|
|
struct NotEquatable { }
|
|
|
|
enum WithArrayOfNotEquatables : Equatable { // expected-error{{type 'WithArrayOfNotEquatables' does not conform to protocol 'Equatable'}}
|
|
case only([NotEquatable])
|
|
}
|
|
|
|
enum WithArrayOfNotEquatables2<T> : Equatable { // expected-error{{type 'WithArrayOfNotEquatables2<T>' does not conform to protocol 'Equatable'}}
|
|
case only([T])
|
|
}
|
|
|
|
|
|
// Okay: T is Equatable
|
|
enum WithArrayOfEquatables1<T: Equatable> : Equatable {
|
|
case only([T])
|
|
}
|
|
|
|
enum WithArrayOfEquatables2<T> {
|
|
case only([T])
|
|
}
|
|
|
|
// Okay: T is Equatable here too
|
|
extension WithArrayOfEquatables2: Equatable where T: Equatable { }
|
|
|