Skip to content

Conversation

lxbndr
Copy link
Contributor

@lxbndr lxbndr commented Jan 10, 2020

I believe it was just a typo. There are other similar checks already, and all of them use <= comparison.

This was discovered as the reason of paragraphRange(for:) fail on whole string range. E.g, following code is crashing:

let s = "abc" as NSString
let range = NSRange(location: 0, length:3)
_ = s.paragraphRange(for: range) // <- crash

Test is also included.

Test checks paragraphRange on:

  • whole string range
  • every subrange in every single paragraph
  • every subrange in every two consecutive paragraphs

This was discovered as the reason of paragraphRange(for:) fail, so test is also included.
@spevans
Copy link
Contributor

spevans commented Jan 11, 2020

@swift-ci test

@compnerd
Copy link
Member

This does seem like a typo. Thanks for fixing this.

@compnerd compnerd merged commit 392d900 into swiftlang:master Jan 24, 2020
@lxbndr lxbndr deleted the nsstring-paragraph-range branch January 24, 2020 19:32
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.

3 participants