mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
If a conformance to a protocol is implied by several other
conformances (i.e. protocol P: Equatable {} and protocol Q: Equatable {} and a
type declares conformance to both P and Q), we should choose a source that's in
the same file as the type, if we can, because automatic synthesis of
conformances (for Equatable, Hashable, etc.) only works in that case.
Fixes rdar://problem/41852654.
32 lines
715 B
Swift
32 lines
715 B
Swift
// Note that for the test to be effective, each of these enums must only have
|
|
// its Equatable or Hashable conformance referenced /once/ in the primary file.
|
|
enum FromOtherFile : String {
|
|
// expected-note@-1 {{type declared here}}
|
|
case A = "a"
|
|
}
|
|
enum AlsoFromOtherFile : Int {
|
|
case A = 0
|
|
}
|
|
enum YetAnotherFromOtherFile: Float {
|
|
case A = 0.0
|
|
}
|
|
|
|
enum OtherFileNonconforming {
|
|
case A(Int)
|
|
}
|
|
enum YetOtherFileNonconforming {
|
|
// expected-note@-1 {{type declared here}}
|
|
case A(Int)
|
|
}
|
|
|
|
enum GenericOtherFileNonconforming<T> {
|
|
// expected-note@-1 {{type declared here}}
|
|
case A(T)
|
|
}
|
|
|
|
protocol ImplierOther: Equatable {}
|
|
extension ImpliedMain: ImplierMain {}
|
|
enum ImpliedOther: ImplierOther {
|
|
case a(Int)
|
|
}
|