[swift-evolution] Testing enum cases with associated values

Anton Zhilin antonyzhilin at gmail.com
Wed Jan 18 02:20:25 CST 2017

AFAICS, Andy needs not default implementations of Equatable, but
cases-as-optional-properties—this topic has also been discussed on the list.

enum Result {
    case success(Int)
    case failure(String)

let r: Result = foo()

let x: Int? = r.success
let y: String? = r.failure

assert(r.success == Optional(42))
assert(r.failure == nil)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170118/1e1865b9/attachment.html>

More information about the swift-evolution mailing list