Details
-
Type:
Bug
-
Status: Open
-
Priority:
Medium
-
Resolution: Unresolved
-
Component/s: Compiler
-
Labels:
-
Environment:
Apple Swift version 4.0.3 (swiftlang-900.0.71 clang-900.0.38)
Target: x86_64-apple-macosx10.9
-
Radar URL:
Description
The following snippet fails to compile:
let test = Dictionary(uniqueKeysWithValues: ["a", "b", "c"].enumerated())
With the message:
Cannot invoke initializer for type 'Dictionary<_, _>' with an argument list of type '(uniqueKeysWithValues: EnumeratedSequence<[String]>)'
The only way I was able to get it to work was to add a pass-through call to "map" on the end:
let test = Dictionary(uniqueKeysWithValues: ["a", "b", "c"].enumerated().map { $0 })
Attachments
Issue Links
- is duplicated by
-
SR-6905 Dictionary(uniqueKeysWithValues:) does not accept sequence of labeled tuples
-
- Resolved
-