[SR-6606] crash on .magnitude applied to literal 0 #49156
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Xcode 9.2
command line tools 9.2 for macOS Sierra 10.12
OR
iPad Pro, iOS 11.0.3, Playgrounds 1.6.1 (674.16)
Additional Detail from JIRA
md5: 8ef0c161f298e619bcd9f9777b9a1e10
duplicates:
Issue Description:
1.create a playground in Xcode OR iPad
2. run this code:
import Foundation
let i : Int = 0
print(i.magnitude) // prints "0\n"
let ui : UInt = 0
print(ui.magnitude) // prints "0\n"
let o = 0.magnitude
3. see run-time error:
error: MyPlaygroundBook.playground:6:11: error: arithmetic operation '18446744073709551615 + 1' (on unsigned 64-bit integer type) results in an overflow
let o = 0.magnitude
The text was updated successfully, but these errors were encountered: