mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The enclosing conformance-lookup operation can fail (i.e., it returns Optional), but the nested call was force-unwrapping the optional from an inner call for no particular reason. Stop doing that, which fixes SR-6466. Note that the offending code is still something that should go away in time, so this is merely polishing the band-aid to avoid a crash that occurs often with conditional conformances.
29 lines
316 B
Swift
29 lines
316 B
Swift
// RUN: not %target-swift-frontend %s -typecheck
|
|
|
|
protocol DC {
|
|
init()
|
|
}
|
|
|
|
protocol P {
|
|
associatedtype A: DC
|
|
|
|
func f() -> A
|
|
}
|
|
|
|
protocol Q: P {
|
|
associatedtype A
|
|
}
|
|
|
|
extension Q {
|
|
func f() -> A { return A() }
|
|
}
|
|
|
|
struct X<T> { }
|
|
|
|
extension X: P where T: P {
|
|
typealias A = T.A
|
|
}
|
|
|
|
extension X: Q where T: Q {
|
|
}
|