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

Ian Partridge ian at poncho.org.uk
Wed Aug 9 11:03:48 CDT 2017


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

Is my suspicion right, and is there any work in progress to bring this into
sync before Swift 4?

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


More information about the swift-corelibs-dev mailing list