File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1103,10 +1103,17 @@ func rdar17170728() {
1103
1103
}
1104
1104
1105
1105
let _ = [ i, j, k] . reduce ( 0 as Int ? ) {
1106
- // expected-error@-1{{missing argument label 'into:' in call}}
1107
- // expected-error@-2{{cannot convert value of type 'Int?' to expected argument type}}
1106
+ // expected-error@-1 3 {{cannot convert value of type 'Int?' to expected element type 'Bool'}}
1107
+ // expected-error@-2 {{value of optional type 'Int?' must be unwrapped to a value of type 'Int'}}
1108
+ // expected-note@-3 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
1109
+ // expected-note@-4 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
1108
1110
$0 && $1 ? $0 + $1 : ( $0 ? $0 : ( $1 ? $1 : nil ) )
1109
- // expected-error@-1 {{binary operator '+' cannot be applied to two 'Bool' operands}}
1111
+ // expected-error@-1 {{type 'Int' cannot be used as a boolean; test for '!= 0' instead}}
1112
+ // expected-error@-2 {{cannot convert value of type 'Bool?' to closure result type 'Int'}}
1113
+ // expected-error@-3 {{result values in '? :' expression have mismatching types 'Int' and 'Bool?'}}
1114
+ // expected-error@-4 {{cannot convert value of type 'Bool' to expected argument type 'Int'}}
1115
+ // expected-error@-5 {{type 'Int' cannot be used as a boolean; test for '!= 0' instead}}
1116
+ // expected-error@-6 {{result values in '? :' expression have mismatching types 'Int' and 'Bool?'}}
1110
1117
}
1111
1118
}
1112
1119
You can’t perform that action at this time.
0 commit comments