Created
February 7, 2018 18:29
-
-
Save milseman/d8360121856f4780bd5172cc94f96251 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct S1 { | |
var stored: UInt? | |
init(_ x: UInt) { | |
if x > 42 { | |
self.init(_big: x) | |
return | |
} | |
self.stored = x // <--- error: 'self' used before 'self.init' call or assignment to 'self' | |
} | |
init(_big x: UInt) { | |
self.stored = x | |
} | |
} | |
struct S2 { | |
var stored: UInt? | |
init(_ x: UInt) { | |
if x > 42 { | |
self.init(_big: x) | |
return | |
} | |
self.init(_small: x) | |
} | |
init(_big x: UInt) { | |
self.stored = x | |
} | |
init(_small x: UInt) { | |
self.stored = x | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment