File tree Expand file tree Collapse file tree 4 files changed +25
-10
lines changed Expand file tree Collapse file tree 4 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ internal func _stringCompareInternal(
97
97
}
98
98
99
99
@_effects ( readonly)
100
- private func _stringCompareFastUTF8(
100
+ internal func _stringCompareFastUTF8(
101
101
_ utf8Left: UnsafeBufferPointer < UInt8 > ,
102
102
_ utf8Right: UnsafeBufferPointer < UInt8 > ,
103
103
expecting: _StringComparisonResult ,
Original file line number Diff line number Diff line change @@ -166,23 +166,22 @@ extension UTF8Span {
166
166
167
167
}
168
168
169
-
170
- func TODO( _ message: String ) -> Never {
171
- fatalError ( " TODO: \( message) " )
169
+ func UNSUPPORTED( _ message: String ) -> Never {
170
+ fatalError ( " UNSUPPORTED: \( message) " )
172
171
}
173
172
174
173
// TODO(toolchain): decide if we rebase on top of Guillaume's work
175
174
@available ( SwiftStdlib 6 . 1 , * )
176
175
extension String {
177
176
public var utf8Span : UTF8Span {
178
- TODO ( " Decide whether to rebase on top of Span PR or wait for merge " )
177
+ UNSUPPORTED ( " utf8Span property pending compiler fixes " )
179
178
}
180
179
}
181
180
182
181
@available ( SwiftStdlib 6 . 1 , * )
183
182
extension Substring {
184
183
public var utf8Span : UTF8Span {
185
- TODO ( " Decide whether to rebase on top of Span PR or wait for merge " )
184
+ UNSUPPORTED ( " utf8Span property pending compiler fixes " )
186
185
}
187
186
}
188
187
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ extension UTF8Span {
75
75
if s. value < 0x300 {
76
76
continue
77
77
}
78
- TODO ( " Refactor and adapt _StringGutsSlice._fastNFCCheck( )" )
78
+ UNSUPPORTED ( " NFC quick check (pending internal refactoring )" )
79
79
}
80
80
self . _countAndFlags |= Self . _nfcBit
81
81
return true
Original file line number Diff line number Diff line change @@ -57,15 +57,31 @@ extension UTF8Span {
57
57
public func isCanonicallyEquivalent(
58
58
to other: UTF8Span
59
59
) -> Bool {
60
- self . _str == other. _str
60
+ self . _withUnsafeBufferPointer { selfBufPtr in
61
+ other. _withUnsafeBufferPointer { otherBufPtr in
62
+ _stringCompareFastUTF8 (
63
+ selfBufPtr,
64
+ otherBufPtr,
65
+ expecting: . equal,
66
+ bothNFC: self . isKnownNFC && other. isKnownNFC)
67
+ }
68
+ }
61
69
}
62
70
63
- /// Whether `self` orders less than `other` under Unicode Canonical
71
+ /// Whether `self` orders less than `other` under Unicode Canonical
64
72
/// Equivalence using normalized code-unit order (in NFC).
65
73
public func isCanonicallyLessThan(
66
74
_ other: UTF8Span
67
75
) -> Bool {
68
- self . _str < other. _str
76
+ self . _withUnsafeBufferPointer { selfBufPtr in
77
+ other. _withUnsafeBufferPointer { otherBufPtr in
78
+ _stringCompareFastUTF8 (
79
+ selfBufPtr,
80
+ otherBufPtr,
81
+ expecting: . less,
82
+ bothNFC: self . isKnownNFC && other. isKnownNFC)
83
+ }
84
+ }
69
85
}
70
86
}
71
87
You can’t perform that action at this time.
0 commit comments