mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When we substitute into an inherited conformance, make sure that we follow the superclass chain from the new conforming type up to the matching superclass *before* doing the substitution. Fixes rdar://problem/35632543.
37 lines
751 B
Swift
37 lines
751 B
Swift
// RUN: %target-swift-frontend %s -emit-ir
|
|
|
|
public protocol ObservableType {
|
|
associatedtype E
|
|
}
|
|
|
|
public protocol SubjectType : ObservableType {
|
|
associatedtype SubjectObserverType : ObserverType
|
|
}
|
|
|
|
extension ObservableType {
|
|
public func multicast<S: SubjectType>(_ subject: S) -> Observable<S.E> {
|
|
while true {}
|
|
}
|
|
}
|
|
|
|
|
|
extension ObservableType {
|
|
public func publish() -> Observable<E> {
|
|
return self.multicast(PublishSubject())
|
|
}
|
|
}
|
|
|
|
public class Observable<Element> : ObservableType {
|
|
public typealias E = Element
|
|
}
|
|
|
|
public protocol ObserverType {
|
|
associatedtype E
|
|
}
|
|
|
|
public final class PublishSubject<Element> : Observable<Element>, SubjectType, ObserverType
|
|
{
|
|
public typealias SubjectObserverType = PublishSubject<Element>
|
|
}
|
|
|