mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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.
31 lines
695 B
Swift
31 lines
695 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
protocol P {
|
|
subscript<Value>(x: Value) -> Int { // expected-note {{protocol requires subscript with type '<Value> (Value) -> Int'; add a stub for conformance}}
|
|
get
|
|
}
|
|
}
|
|
|
|
struct S : P { // expected-error {{type 'S' does not conform to protocol 'P'}}
|
|
subscript<Value>(x: Int) -> Value { // expected-note {{candidate has non-matching type '<Value> (Int) -> Value'}}
|
|
} // expected-error {{missing return in subscript expected to return 'Value'}}
|
|
}
|
|
|
|
struct S2: P {
|
|
subscript<Value>(x: Value) -> Int {
|
|
return 123
|
|
}
|
|
}
|
|
|
|
protocol P2 {
|
|
subscript(x: Int) -> Int {
|
|
get
|
|
}
|
|
}
|
|
|
|
struct S3: P2 {
|
|
subscript(x: Int) -> Int {
|
|
return x
|
|
}
|
|
}
|