The following code does not compile in Swift 3.0 and it used to compile
in Swift 2.2. I'm pretty sure it is a bug in Swift 3.0, since it used to
work in Swift 2.2, but perhaps it was a bug that it worked in Swift 2.2.

Help?

extension Dictionary {
    init<S: Sequence where S.Iterator.Element == Element>(pairs: S) {
        self.init()
        for (key, value) in pairs {
            self[key] = value
        }
    }
}

let foo = ["Lorem", "ipsum"]
let bar = ["dolor", "sit"]
let baz = zip(foo, bar)
let qux = baz.lazy
    .map({ ($0.uppercased(), $1.uppercased()) })

Dictionary(pairs: baz)
Dictionary(pairs: qux)

The before and after code can be seen in this gist.
https://gist.github.com/anonymous/30cfb47de65b37f4a99429e3d0392de8
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to