Skip to content

[SR-187] Incorrect behavior for Int(_, radix:) #42809

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

Closed
swift-ci opened this issue Dec 11, 2015 · 2 comments
Closed

[SR-187] Incorrect behavior for Int(_, radix:) #42809

swift-ci opened this issue Dec 11, 2015 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. good first issue Good for newcomers standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-187
Radar None
Original Reporter PatrickPijnappel (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, StarterBug
Assignee PatrickPijnappel (JIRA)
Priority Medium

md5: 83c44df492df40d194828ff6d075d8fc

Issue Description:

The docs for Int(_, radix:) lists the regex as being

[-+]?[0-9a-zA-Z]

but the exact regex for the code as is seems to be

(-+?|+?)[0-9a-zA-Z]*|-*0)

That is, it accepts these cases beyond what the docs specify:

  • Any number of minuses followed by a 0

  • A minus followed by a plus followed by any number

It seems unlikely this is by design, and contradicts the documentation by not returning nil in those cases.

@swift-ci
Copy link
Contributor Author

Comment by Patrick Pijnappel (JIRA)

Patch in PR #613 (#613

@swift-ci
Copy link
Contributor Author

Comment by Patrick Pijnappel (JIRA)

Merged.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. good first issue Good for newcomers standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant