[SR-14824] Improve diagnostic for multi-statement closures instead of saying "too complex closure return type"

This commit is contained in:
jiaren wang
2021-06-30 11:18:19 +08:00
parent 340c85503e
commit c5de1f0800
9 changed files with 17 additions and 18 deletions

View File

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