Skip to content

[Need Feedback]: Added bounds checking to NSArray subscript #15

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

Merged
merged 1 commit into from
Dec 4, 2015
Merged

[Need Feedback]: Added bounds checking to NSArray subscript #15

merged 1 commit into from
Dec 4, 2015

Conversation

KaiCode2
Copy link

@KaiCode2 KaiCode2 commented Dec 4, 2015

Completed bounds checking however I need feedback on what should should be done if the index is out of range.

@KaiCode2
Copy link
Author

KaiCode2 commented Dec 4, 2015

@phausler I corrected the PR to incorporate the changes you mentioned. Let me know if there is anything else to add 🙂

@parkera
Copy link
Contributor

parkera commented Dec 4, 2015

Thanks, this looks good. Could you rebase this into a single commit for us to merge in?

added fatalError clause and corrected the if statement

Restructured the PR
@Adlai-Holler
Copy link
Contributor

Would precondition(idx >= 0 && idx < count) be a cleaner equivalent?

@KaiCode2
Copy link
Author

KaiCode2 commented Dec 4, 2015

@parkera finished the rebase, let me know if it's all good.

parkera added a commit that referenced this pull request Dec 4, 2015
Added bounds checking to NSArray subscript
@parkera parkera merged commit 305b4bf into swiftlang:master Dec 4, 2015
@parkera
Copy link
Contributor

parkera commented Dec 4, 2015

@Adlai-Holler precondition sounds like it might be good too, since it takes the optimization level into account. We can consider that as another change (also perhaps moving this into the objectAtIndex call itself as discussed on mailing list).

@KaiCode2
Copy link
Author

KaiCode2 commented Dec 4, 2015

@Adlai-Holler I think the issue with the precondition is the lack of an error message on release builds.

@gribozavr
Copy link
Contributor

You can provide a message as the second parameter to precondition(). The message is displayed in debug builds.

atrick pushed a commit to atrick/swift-corelibs-foundation that referenced this pull request Jan 12, 2021
…n-fix

[Completion] Fix crash for completion on identifier at the start of file
kateinoigakukun pushed a commit to kateinoigakukun/swift-corelibs-foundation that referenced this pull request Apr 29, 2021
…xctest-test

Add a test to check if we can run swift-test on a complex package
kateinoigakukun pushed a commit to kateinoigakukun/swift-corelibs-foundation that referenced this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants