mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When adding a superclass constraint, we need to find any nested types belonging to protocols that the superclass conforms to, and introduce implicit same-type constraints between each nested type and the corresponding type witness in the superclass's conformance to that protocol. Fixes <rdar://problem/39481178>, <https://bugs.swift.org/browse/SR-11232>.
27 lines
630 B
Swift
27 lines
630 B
Swift
// RUN: not %target-swift-emit-silgen %s
|
|
|
|
protocol Pub {
|
|
associatedtype Other
|
|
associatedtype Failure: Error
|
|
}
|
|
|
|
class AnyPub<Other, Failure: Error> {}
|
|
|
|
extension Pub {
|
|
func erase() -> AnyPub<Other, Failure> {
|
|
return AnyPub<Other, Failure>()
|
|
}
|
|
}
|
|
|
|
protocol ObsObj : Pub {
|
|
associatedtype NeverPub : Pub where Self.NeverPub.Failure == Never
|
|
}
|
|
|
|
class Subject<Other, Failure: Error> : Pub {}
|
|
|
|
extension Pub where Other: ObsObj, Other.NeverPub: Subject<Int, Error> {
|
|
static func f() -> AnyPub<Other.NeverPub.Other, Other.NeverPub.Failure> {
|
|
return Subject<Other.NeverPub.Other, Other.NeverPub.Failure>().erase()
|
|
}
|
|
}
|