mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Tell the user if the specialization isn't done because of a dynamic Self type. rdar://150865684
26 lines
702 B
Swift
26 lines
702 B
Swift
// RUN: %target-swift-emit-ir -parse-as-library -module-name main -verify %s -enable-experimental-feature Embedded -swift-version 5 -wmo -o /dev/null
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
// REQUIRES: optimized_stdlib
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
// We don't support calling a default witness method (which is generic) with dynamic self.
|
|
|
|
public protocol P {
|
|
init(x: Int)
|
|
}
|
|
|
|
extension P {
|
|
init(y: Int) {
|
|
self.init(x: y)
|
|
}
|
|
}
|
|
|
|
public class C: P {
|
|
public required init(x: Int) {}
|
|
|
|
public convenience init(z: Int) {
|
|
self.init(y: z) // expected-error {{cannot call an initializer or static method, which is defined as default protocol method, from a class method or initializer}}
|
|
}
|
|
}
|