Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0130-rdar35632543.swift
Doug Gregor 41e0648336 [AST] Properly adjust substitution type for inherited conformances.
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.
2017-11-19 21:50:24 -08:00

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>
}