[swift-corelibs-dev] NSString.range(of:options:range:locale) incompatibility

Tony Parker anthony.parker at apple.com
Wed Aug 9 11:23:48 CDT 2017


Hi Ian,

I don’t think Max has put up that PR against the swift-corelibs-foundation implementation, but we should.

- Tony

> On Aug 9, 2017, at 9:04 AM, Ian Partridge via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> I've noticed this current difference in behaviour.
> 
> Darwin:
> 
> $ swift
> Welcome to Apple Swift version 4.0-dev (LLVM 2dedb62a0b, Clang b9d76a314c, Swift 6b4756bd93). Type :help for assistance.
>   1> import Foundation
>   2> "abc".range(of: "a")!.lowerBound..<"abc".range(of: "a")!.upperBound
> $R0: Range<String.Index> = {
>   lowerBound = {
>     _compoundOffset = 0
>     _cache = utf16
>   }
>   upperBound = {
>     _compoundOffset = 4
>     _cache = utf16
>   }
> }
> 
> Linux:
> 
> $ swift
> Welcome to Swift version 4.0-dev (LLVM 2dedb62a0b, Clang b9d76a314c, Swift 6b4756bd93). Type :help for assistance.
>   1> import Foundation 
>   2> "abc".range(of: "a")!.lowerBound..<"abc".range(of: "a")!.upperBound 
> $R0: CountableRange<String.Index> = {
>   lowerBound = {
>     _compoundOffset = 0
>     _cache = utf16
>   }
>   upperBound = {
>     _compoundOffset = 4
>     _cache = utf16
>   }
> }
> 
> I think this might be because some changes made in the overlay (NSStringAPI.swift) haven't been ported across to swift-corelibs-foundation:
> 
> https://github.com/apple/swift/commit/5f1c3f702189f8197e297479d464dc454330be80 <https://github.com/apple/swift/commit/5f1c3f702189f8197e297479d464dc454330be80>
> 
> Is my suspicion right, and is there any work in progress to bring this into sync before Swift 4?
> 
> -- 
> Ian Partridge
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20170809/7bfb86ad/attachment.html>


More information about the swift-corelibs-dev mailing list