Skip to content

Commit 62500a5

Browse files
authored
Follow up for swiftlang#278 : make the required function from FoundationEssentials package so we can use it from FoundationI18n (swiftlang#286)
* Follow up for swiftlang#278 : make the required function from FoundationEssentials `package` so we can use it from FoundationI18n * Workaround TAPI error by removing the default arguments
1 parent 25014fc commit 62500a5

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Sources/FoundationEssentials/String/BidirectionalCollection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extension BidirectionalCollection {
7474
return idx
7575
}
7676

77-
func _range<S: BidirectionalCollection>(of other: S, anchored: Bool = false, backwards: Bool = false) -> Range<Index>? where S.Element == Element, Element : Equatable {
77+
package func _range<S: BidirectionalCollection>(of other: S, anchored: Bool, backwards: Bool) -> Range<Index>? where S.Element == Element, Element : Equatable {
7878
var result: Range<Index>? = nil
7979
var fromLoc: Index
8080
var toLoc: Index

Sources/FoundationEssentials/TimeZone/TimeZone_Cache.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ struct TimeZoneCache : Sendable {
174174
#else
175175
let lookFor = TimeZone.TZDIR + "/"
176176
#endif
177-
if let rangeOfZoneInfo = file._range(of: lookFor) {
177+
if let rangeOfZoneInfo = file._range(of: lookFor, anchored: false, backwards: false) {
178178
let name = file[rangeOfZoneInfo.upperBound...]
179179
if let result = fixed(String(name)) {
180180
return TimeZone(inner: result)

Sources/FoundationInternationalization/Formatting/Duration+UnitsFormatStyle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ extension Duration {
252252
let formattedFields = _formatFields(duration)
253253
var result = _getFullListPattern(length: formattedFields.count)
254254
for formattedField in formattedFields.reversed() {
255-
let range = result._range(of: "{0}", backwards: true)!
255+
let range = result._range(of: "{0}", anchored: false, backwards: true)!
256256
result.replaceSubrange(range, with: formattedField)
257257
}
258258
return result

Tests/FoundationInternationalizationTests/Formatting/DateFormatStyleTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ final class MatchConsumerAndSearcherTests : XCTestCase {
11201120
// Disabled in package because _range is imported twice, once from Essentials, once from Internationalization
11211121
func testMatchPartialRangesFromBeginning() {
11221122
func verify(_ string: String, matches format: Date.FormatString, expectedMatch: String, expectedDate: TimeInterval, file: StaticString = #file, line: UInt = #line) {
1123-
let occurrenceRange = string._range(of: expectedMatch)!
1123+
let occurrenceRange = string._range(of: expectedMatch, anchored: false, backwards: false)!
11241124
_verifyString(string, matches: format, start: string.startIndex, in: string.startIndex..<string.endIndex, expectedUpperBound: occurrenceRange.upperBound, expectedDate: Date(timeIntervalSinceReferenceDate: expectedDate), file: file, line: line)
11251125
}
11261126

0 commit comments

Comments
 (0)