Last active
June 2, 2016 22:05
-
-
Save lorentey/4dd95966e92e72534cce29966747e2a7 to your computer and use it in GitHub Desktop.
The following snippet compiles under Swift 2.2, but not Swift 3. It defines a (quite useless) left shift operator on `Double` values. For some reason, Swift 3's type inference engine can go awry when such a shift operator is used in a subexpression.
This file contains 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
public func <<(num: Double, exp: Int) -> Double { | |
return num * Double(1 << exp) | |
} | |
let s = (0.5 << 5) - 1 | |
print(s) |
Reported as https://bugs.swift.org/browse/SR-1668
Are you sure that's a bug? It looks to me as if a bug were fixed not introduced
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swift 2.2:
Swift 3: