-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement NSTextCheckingResult.range(withName:) #1522
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
Conversation
@swift-ci please test |
I realized that I'm not sure what to do with the availability story.
|
@swift-ci please test |
0aedad0
to
e167c45
Compare
@parkera Seems like the test wasn't run or the result not reported back? |
@swift-ci please test |
The build passed but the from log it seems it was run on a commit that was squashed and no longer exist (0aedad0) even before @spevans requested the build ... |
Would a kind soul please rerun the test? :-) |
@swift-ci please test |
@parkera Not sure what the normal review time frames are... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one nitpick and then it’s good to merge:
@@ -57,6 +57,7 @@ _CFRegularExpressionRef _Nullable _CFRegularExpressionCreate(CFAllocatorRef allo | |||
void _CFRegularExpressionDestroy(_CFRegularExpressionRef regex); | |||
|
|||
CFIndex _CFRegularExpressionGetNumberOfCaptureGroups(_CFRegularExpressionRef regex); | |||
CFIndex _CFRegularExpressionGetCaptureGroupNumberWithName(_CFRegularExpressionRef regex, CFStringRef groupName) API_AVAILABLE(macosx(10.13), ios(11.0), watchos(4.0), tvos(11.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why availability annotations? Internal calls do not need them, and in this case they would also be inaccurate (this call isn’t on any of the mentioned OSes.)
Just remove them, here and in the Swift code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @millenomi !
I wasn't sure what to do with the annotations so to be safe I made sure to add to all APIs.
Sorry for that.
I removed on internal APIs and only left on the public NSTextCheckingResult.range(withName:)
.
e167c45
to
4b22b29
Compare
@swift-ci please test |
@spevans Thanks for starting the build! https://ci.swift.org/view/Pull%20Request/job/swift-corelibs-foundation-PR-Linux/961/console |
There is just one issue I see with this change and its that Ubuntu 14.04 uses ICU 52 and so doesn't have the Is it possible to use the I think this will cause problems if merged as it will then break the 14.04 package build (although it is current broken due to a different 14.04/ ICU issue anyway, see #1537) |
@nevil swift-ci looks fine, its just misleading with the first comment.
which means its merging in the correct version. |
@spevans You're correct. Looks like the commit hash mismatch is just for the GitHub build status reporting... I could of course use U_ICU_VERSION_MAJOR_NUM (or some other flag) to conditionally enable the _CFRegularExpressionGetCaptureGroupNumberWithName, but the question is if this is an acceptable workaround until all supported Linux versions use the same ICU library? It would introduce a version difference that can not be checked through the use of availability annotation checks... |
You could do something like the following: Define
|
4b22b29
to
bb56345
Compare
@millenomi |
@nevil Are you still interested in chaperoning this patch? |
@millenomi Sorry for that! Is it best to try to get this in with build time version detection of ICU (as suggested here https://forums.swift.org/t/building-libicu-as-part-of-the-linux-swift-build/16526/8 to settle? |
@nevil The PR to always build the latest version of ICU for linux should hopefully be ready in the next day or so - I just have to fix one LLDB test - so you can probably leave the version detection out now. In fact it will be good to since it should catch builds using the old version since the symbols won't be defined. |
@spevans Great. Thank you very much! I will rebase this PR on the latest master branch in preparation for your PR to be merged. |
bb56345
to
d8ed8a6
Compare
Nothing had really changed in the touched files so the rebase was straight forward. |
Waiting for swiftlang/swift#19860 |
d8ed8a6
to
2772e1a
Compare
@spevans |
@swift-ci test |
@millenomi Thanks! |
2772e1a
to
65319df
Compare
65319df
to
34f3ce5
Compare
34f3ce5
to
8ce01f2
Compare
- Added the missing range(withName:) and corresponding CF function. The implementation relies on uregex_groupNumberFromName which is available as a draft API from ICU 55. - Added tests related to named capture groups. - Add availability checks in the tests to run with DarwinCompatibilityTests.
8ce01f2
to
35739c9
Compare
@millenomi Any chance of reviewing again? |
@swift-ci please test |
This looks good to me. |
Sorry this took so long and thank you for the contribution! |
@parkera |
motivation: * netrc functionality is useful on all platforms, the regex functionality was added to non-darwin foundation * see swiftlang/swift-corelibs-foundation#1522 changes: remove platforms restructions where appropriate
motivation: * netrc functionality is useful on all platforms, the regex functionality was added to non-darwin foundation * see swiftlang/swift-corelibs-foundation#1522 changes: remove platforms restructions where appropriate
motivation: * netrc functionality is useful on all platforms, the regex functionality was added to non-darwin foundation * see swiftlang/swift-corelibs-foundation#1522 changes: remove platforms restructions where appropriate
motivation: * netrc functionality is useful on all platforms, the regex functionality was added to non-darwin foundation * see swiftlang/swift-corelibs-foundation#1522 changes: remove platforms restructions where appropriate
motivation: * netrc functionality is useful on all platforms, the regex functionality was added to non-darwin foundation * see swiftlang/swift-corelibs-foundation#1522 changes: remove platforms restructions where appropriate
Added the missing range(withName:) and corresponding CF function.
The implementation relies on uregex_groupNumberFromName which is
available as a draft API from ICU 55.
Added tests related to named capture groups.