[swift-users] RawRepresentable bug or intended?

Adrian Zubarev adrian.zubarev at devandartist.com
Thu Sep 29 01:00:11 CDT 2016


struct B : RawRepresentable {
     
    let rawValue: Int
     
//  init?(rawValue: Int) {
//
//      self.rawValue = rawValue
//  }
     
    static let c: B = B(rawValue: 0)
    static let d: B = B(rawValue: 1)
}
It seems to me that the memberwise initializer init(rawValue: Int) ignores the failable initializer init?(rawValue: Int) from RawRepresentable and is even able to satisfy RawRepresentable in that case.



-- 
Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160929/6c553fce/attachment.html>


More information about the swift-users mailing list