Files
swift-mirror/test/embedded/generic-error.swift
Erik Eckstein be322877b1 EmbeddedSwiftDiagnostics: improve error message for non-specialized generic function calls
Tell the user if the specialization isn't done because of a dynamic Self type.

rdar://150865684
2025-05-08 19:21:08 +02:00

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