[SR-6905] Dictionary(uniqueKeysWithValues:) does not accept sequence of labeled tuples #49454
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Environment
Tested with Xcode 9.2 (9C40b) and 9.3 beta (9Q98q).
Additional Detail from JIRA
md5: b490eff86091f31e423165d5d7a660f6
duplicates:
Issue Description:
(From https://forums.swift.org/t/creating-a-dictionary-from-an-enumeratedsequence/9472 )
The following code does not compile:
The same happens with the other dictionary initializer taking a key/value sequence:
The reason seems to be that the tuples from the EnumeratedSequence have labels, in this case (offset: Int, element: String). Another example which produces the same error:
Removing the tuple labels makes it compile and work as expected:
The text was updated successfully, but these errors were encountered: