Files
swift-mirror/validation-test/compiler_crashers_2_fixed/sr11232.swift
Slava Pestov 514a0423b6 GSB: Concretize nested types when adding a superclass constraint
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>.
2020-05-15 21:58:58 -04:00

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