mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SR-14824] Improve diagnostic for multi-statement closures instead of saying "too complex closure return type"
This commit is contained in:
@@ -230,14 +230,14 @@ func good(_ a: A<EE>) -> Int {
|
||||
}
|
||||
|
||||
func bad(_ a: A<EE>) {
|
||||
a.map { // expected-error {{unable to infer complex closure return type; add explicit type to disambiguate}} {{none}}
|
||||
a.map { // expected-error {{cannot infer return type for closure with multiple statements; add explicit type to disambiguate}} {{none}}
|
||||
let _: EE = $0
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
func ugly(_ a: A<EE>) {
|
||||
a.map { // expected-error {{unable to infer complex closure return type; add explicit type to disambiguate}} {{none}}
|
||||
a.map { // expected-error {{cannot infer return type for closure with multiple statements; add explicit type to disambiguate}} {{none}}
|
||||
switch $0 {
|
||||
case .A:
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user