Skip to content

Commit db3066d

Browse files
committed
[NFC][Diagnostics] Add a test case for rdar://71829040.
1 parent d083c66 commit db3066d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/Constraints/diagnostics.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,14 @@ func r22263468(_ a : String?) {
576576
_ = MyTuple(42, a) // expected-error {{tuple type '(Int, String?)' is not convertible to tuple type 'MyTuple' (aka '(Int, String)')}}
577577
}
578578

579+
// rdar://71829040 - "ambiguous without more context" error for tuple type mismatch.
580+
func r71829040() {
581+
func object(forKey: String) -> Any? { nil }
582+
583+
let flags: [String: String]
584+
// expected-error@+1 {{tuple type '(String, Bool)' is not convertible to tuple type '(String, String)'}}
585+
flags = Dictionary(uniqueKeysWithValues: ["keyA", "keyB"].map { ($0, object(forKey: $0) as? Bool ?? false) })
586+
}
579587

580588
// rdar://22470302 - Crash with parenthesized call result.
581589
class r22470302Class {

0 commit comments

Comments
 (0)