Makes sense. Thanks!
> On Oct 26, 2017, at 1:01 PM, Itai Ferber <ifer...@apple.com> wrote: > > Hi Robert, > > When the conditional conformance feature arrives in Swift, it will allow us > to express extension Array : Encodable where Element : Encodable and > extension Array : Decodable where Element : Decodable. > At the moment, this isn’t possible, so Array is unconditionally Codable and > the failure happens at runtime. This will be a compile-time error in a future > version of Swift. > > — Itai > > On 26 Oct 2017, at 9:47, Robert Nikander via swift-users wrote: > > Hi, > > This error makes perfect sense, but I’m surprised it's a runtime error. I > expected it at compile time. Am I doing something wrong? Is this on the type > system to-do list? > > let c = JSONEncoder() > struct Foo { … } > let fs: [Foo] = [ Foo(...) ] > let data = try! c.encode(fs) // Didn’t think this would compile > > The runtime error is: fatal error: Array<Foo> does not conform to Encodable > because Foo does not conform to Encodable. > > Rob_______________________________________________ > swift-users mailing list > swift-users@swift.org <mailto:swift-users@swift.org> > https://lists.swift.org/mailman/listinfo/swift-users > <https://lists.swift.org/mailman/listinfo/swift-users>
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users