mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This commit changes fixit messages from a question/suggestion to an imperative message for protocol conformances and switch-case. Addresses https://github.com/apple/swift/issues/67510.
23 lines
731 B
Swift
23 lines
731 B
Swift
// RUN: %target-swift-frontend -typecheck -verify %s
|
|
|
|
// https://github.com/apple/swift/issues/52995
|
|
|
|
protocol Nested {
|
|
associatedtype U // expected-note {{protocol requires nested type 'U'; add nested type 'U' for conformance}}
|
|
}
|
|
|
|
class A<M> {
|
|
func f<T : Nested>(_ t: T, _ keyPath: WritableKeyPath<M, T.U>) {}
|
|
}
|
|
|
|
class B<Y> : Nested { // expected-error {{type 'B<Y>' does not conform to protocol 'Nested'}}
|
|
var i: Y?
|
|
}
|
|
|
|
|
|
class C<M> {
|
|
func cFunc(_ a: A<M>) {
|
|
let function: (B<Int>, ReferenceWritableKeyPath<M, Int>) -> Void = a.f // expected-error {{cannot convert value of type '(B<Int>, WritableKeyPath<M, B<Int>.U>) -> ()' to specified type '(B<Int>, ReferenceWritableKeyPath<M, Int>) -> Void'}}
|
|
}
|
|
}
|