Files
swift-mirror/test/Constraints/rdar107651291.swift
Hamish Knight b5e9bbb68d [CS] Fix IgnoreUnresolvedPatternVar::diagnose such that it returns false
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
2023-05-04 14:53:57 +01:00

13 lines
615 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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()'}}
}
}