Files
swift-mirror/test/Constraints/rdar107651291.swift
Pavel Yaskevich 3ca54ae9da [CSGen] Use OptionalObject constraint to connect element type and result of next()
Previously this wasn't possible because of `one-way` bind constraints
involved in pattern inference but this no longer the case.
2023-09-29 17:33:07 -07:00

13 lines
703 B
Swift
Raw Permalink 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 global function 'zip' where 'Sequence2' = 'Dictionary<String, [String]>.Element' (aka '(key: String, value: Array<String>)')}}
}
}