[SR-7948] Range<UInt>, Range<Int64>, Range<UInt64> (and ClosedRange) don't trap on overflow #50483
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Xcode 10 beta 1
Swift version 4.2 (swiftlang-1000.0.16.4 clang-1000.0.25.3)
macOS 10.13.4 (64 Bit)
Additional Detail from JIRA
md5: ee0a4e5e5dca13901478b4828f3f5e91
Issue Description:
The expressions
(Int.min..<Int.max).count
and(Int.min...Int.max).count
correctly trap because of an integer overflow. However, the same expressions withUInt
,Int64
, andUInt64
don't trap. The half-open range versions each return-1
, whereas the closed-range versions return0
.Half-open ranges:
Closed ranges:
I think all of these should trap.
This is not a regression from Swift 4.1. I'm seeing the same behavior with Xcode 9.4 (Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2)).
The text was updated successfully, but these errors were encountered: