Skip to content

Commit fd7a8fa

Browse files
authored
Merge pull request swiftlang#36336 from CodaFi/diaggregate
Fixup Diagnostic Expectations
2 parents 9d5baaa + 13ff5bb commit fd7a8fa

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/Constraints/diagnostics.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,10 +1103,17 @@ func rdar17170728() {
11031103
}
11041104

11051105
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'}}
11081110
$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?'}}
11101117
}
11111118
}
11121119

0 commit comments

Comments
 (0)