mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Returning `true` is wrong here as we could have the error diagnosed by another fix, which if not handled, would lead to us crashing as we assume we diagnosed the issue. Instead, return `false`, allowing us to at least bail with a bad error rather than a crash. We still need to go through and update argument list diagnostic logic to handle patterns, but I'm leaving that as future work for now. rdar://107724970 rdar://107651291
13 lines
615 B
Swift
13 lines
615 B
Swift
// RUN: %target-typecheck-verify-swift
|
||
|
||
// rdar://107651291 – Make sure we don't crash
|
||
func foo(xs: [String: [String]], ys: [String: [String]]) {
|
||
for (key, value) in xs {
|
||
guard let ys = ys.first(where: { $0.key == key }) else { return }
|
||
for (a, b) in zip(xs, ys) {}
|
||
// expected-error@-1 {{type 'Dictionary<String, [String]>.Element' (aka '(key: String, value: Array<String>)') cannot conform to 'Sequence'}}
|
||
// expected-note@-2 {{only concrete types such as structs, enums and classes can conform to protocols}}
|
||
// expected-note@-3 {{required by referencing instance method 'next()'}}
|
||
}
|
||
}
|