Last active
August 29, 2015 14:25
-
-
Save hiroshi-maybe/d90dfe63f6ca046dae73 to your computer and use it in GitHub Desktop.
Infinite recursive call in Swift 2.0
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
| protocol Eq { | |
| typealias A = Self | |
| func equalsTo(a: A) -> Bool | |
| func notEqualsTo(a: A) -> Bool | |
| } | |
| extension Eq { | |
| func equalsTo(a: A) -> Bool { return !self.notEqualsTo(a) } | |
| func notEqualsTo(a: A) -> Bool { return self.equalsTo(a) } | |
| } | |
| extension Int : Eq { | |
| func equalsTo(a: Int) -> Bool { return self == a } | |
| } | |
| let x = 1 | |
| // infinite recursive call happens and crashes on Xcode Version 7.0 beta 4 (7A165t) | |
| print("x \(x.notEqualsTo(1))") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment