New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-1091] pattern 0...Int.max leads to "fatal error: Range end index has no valid successor" #43704
Comments
Comment by Arsen Gasparyan (JIRA) It works like that because Swift does _precondition(end.successor() > end, "Range end index has no valid successor") And for Int8.max.successor() => -128 and -128 > 128 == false. It does it because `Range` struct works with it `return Range(_start: start, end: end.successor())`. @gribozavr could you share your opinion? |
This issue is known. It can't be fixed in the current Range representation. @dabrahams has implemented a new representation that fixes it in our branch for the new collections model: https://github.com/apple/swift/tree/swift-3-indexing-model |
Comment by Daniel Strobusch (JIRA) Issue seems to be solved for data types up to 32 bit, but not for 64bit data type in swift 3. #!/usr/bin/env swift
for i in (UInt64.max - 1)...UInt64.max
{
} while it works for all smaller data types. |
I think this was fixed in Swift 3, as such it should be closed. |
Comment by Daniel Strobusch (JIRA) As commented earlier, it is not fixed for 64 bit data types. |
dastrobu (JIRA User) This appears to be resolved. Can it be closed? |
Comment by Daniel Strobusch (JIRA) retested in Swift 5.3.2. Issue seems to be fixed. |
Environment
Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29)
Additional Detail from JIRA
md5: f5f5fc1e617431187031186270fef9d2
Issue Description:
The following minimal swift program
leads to the fatal error:
fatal error: Range end index has no valid successor
The same behavior can be observed for other int types.
Find the full error message below
The text was updated successfully, but these errors were encountered: