Skip to content

Commit 39655ef

Browse files
committed
Temporary changes for toolchain
1 parent a5975fe commit 39655ef

File tree

5 files changed

+126
-34
lines changed

5 files changed

+126
-34
lines changed

Diff for: stdlib/public/core/Character.swift

+93-1
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,102 @@ extension Character {
270270
/// assert(nfc == nfd)
271271
/// ```
272272
///
273-
@available(SwiftStdlib 9999, *)
273+
// @available(SwiftStdlib 9999, *)
274274
public func normalized(
275275
_ form: Unicode.CanonicalNormalizationForm
276276
) -> Character {
277277
Character(unchecked: _str.normalized(form))
278278
}
279279
}
280+
281+
// FIXME: Improve these and move them somewhere logical.
282+
283+
extension String.UTF8View: Equatable, Hashable, Comparable {
284+
285+
public static func == (lhs: Self, rhs: Self) -> Bool {
286+
lhs.elementsEqual(rhs)
287+
}
288+
289+
public static func < (lhs: Self, rhs: Self) -> Bool {
290+
lhs.lexicographicallyPrecedes(rhs)
291+
}
292+
293+
public func hash(into hasher: inout Hasher) {
294+
for cu in self { hasher.combine(cu) }
295+
}
296+
}
297+
298+
extension Substring.UTF8View: Equatable, Hashable, Comparable {
299+
300+
public static func == (lhs: Self, rhs: Self) -> Bool {
301+
lhs.elementsEqual(rhs)
302+
}
303+
304+
public static func < (lhs: Self, rhs: Self) -> Bool {
305+
lhs.lexicographicallyPrecedes(rhs)
306+
}
307+
308+
public func hash(into hasher: inout Hasher) {
309+
for cu in self { hasher.combine(cu) }
310+
}
311+
}
312+
313+
extension String.UTF16View: Equatable, Hashable, Comparable {
314+
315+
public static func == (lhs: Self, rhs: Self) -> Bool {
316+
lhs.elementsEqual(rhs)
317+
}
318+
319+
public static func < (lhs: Self, rhs: Self) -> Bool {
320+
lhs.lexicographicallyPrecedes(rhs)
321+
}
322+
323+
public func hash(into hasher: inout Hasher) {
324+
for cu in self { hasher.combine(cu) }
325+
}
326+
}
327+
328+
extension Substring.UTF16View: Equatable, Hashable, Comparable {
329+
330+
public static func == (lhs: Self, rhs: Self) -> Bool {
331+
lhs.elementsEqual(rhs)
332+
}
333+
334+
public static func < (lhs: Self, rhs: Self) -> Bool {
335+
lhs.lexicographicallyPrecedes(rhs)
336+
}
337+
338+
public func hash(into hasher: inout Hasher) {
339+
for cu in self { hasher.combine(cu) }
340+
}
341+
}
342+
343+
extension String.UnicodeScalarView: Equatable, Hashable, Comparable {
344+
345+
public static func == (lhs: Self, rhs: Self) -> Bool {
346+
lhs.elementsEqual(rhs)
347+
}
348+
349+
public static func < (lhs: Self, rhs: Self) -> Bool {
350+
lhs.lexicographicallyPrecedes(rhs)
351+
}
352+
353+
public func hash(into hasher: inout Hasher) {
354+
for cu in self { hasher.combine(cu) }
355+
}
356+
}
357+
358+
extension Substring.UnicodeScalarView: Equatable, Hashable, Comparable {
359+
360+
public static func == (lhs: Self, rhs: Self) -> Bool {
361+
lhs.elementsEqual(rhs)
362+
}
363+
364+
public static func < (lhs: Self, rhs: Self) -> Bool {
365+
lhs.lexicographicallyPrecedes(rhs)
366+
}
367+
368+
public func hash(into hasher: inout Hasher) {
369+
for cu in self { hasher.combine(cu) }
370+
}
371+
}

Diff for: stdlib/public/core/String.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ extension String {
810810
/// - scalars: A sequence of Unicode scalar values.
811811
///
812812
@inlinable
813-
@available(SwiftStdlib 9999, *)
813+
// @available(SwiftStdlib 9999, *)
814814
public init(
815815
_ scalars: consuming Unicode.NormalizedScalars<some Sequence>.NFC
816816
) {
@@ -829,7 +829,7 @@ extension String {
829829
/// - scalars: A sequence of Unicode scalar values.
830830
///
831831
@inlinable
832-
@available(SwiftStdlib 9999, *)
832+
// @available(SwiftStdlib 9999, *)
833833
public init(
834834
_ scalars: consuming Unicode.NormalizedScalars<some Sequence>.NFKC
835835
) {

Diff for: stdlib/public/core/StringNormalization.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extension Unicode {
3131
/// allow one to choose whether the result contains the composed (NFC)
3232
/// or decomposed (NFD) representations of these characters.
3333
///
34-
@available(SwiftStdlib 9999, *)
34+
// @available(SwiftStdlib 9999, *)
3535
@frozen
3636
public enum CanonicalNormalizationForm {
3737

@@ -74,7 +74,7 @@ extension Unicode {
7474
/// allow one to choose whether the result contains the composed (NFKC)
7575
/// or decomposed (NFKD) representations of these characters.
7676
///
77-
@available(SwiftStdlib 9999, *)
77+
// @available(SwiftStdlib 9999, *)
7878
@frozen
7979
public enum CompatibilityNormalizationForm {
8080

@@ -132,7 +132,7 @@ extension StringProtocol {
132132
///
133133
@_specialize(where Self == String)
134134
@_specialize(where Self == Substring)
135-
@available(SwiftStdlib 9999, *)
135+
// @available(SwiftStdlib 9999, *)
136136
public func normalized(
137137
_ form: Unicode.CanonicalNormalizationForm
138138
) -> String {
@@ -230,7 +230,7 @@ extension StringProtocol {
230230
///
231231
@_specialize(where Self == String)
232232
@_specialize(where Self == Substring)
233-
@available(SwiftStdlib 9999, *)
233+
// @available(SwiftStdlib 9999, *)
234234
public func stableNormalization(
235235
_ form: Unicode.CanonicalNormalizationForm
236236
) -> String? {
@@ -291,7 +291,7 @@ extension StringProtocol {
291291
///
292292
@_specialize(where Self == String)
293293
@_specialize(where Self == Substring)
294-
@available(SwiftStdlib 9999, *)
294+
// @available(SwiftStdlib 9999, *)
295295
public func normalized(
296296
_ form: Unicode.CompatibilityNormalizationForm
297297
) -> String {
@@ -362,7 +362,7 @@ extension StringProtocol {
362362
///
363363
@_specialize(where Self == String)
364364
@_specialize(where Self == Substring)
365-
@available(SwiftStdlib 9999, *)
365+
// @available(SwiftStdlib 9999, *)
366366
public func stableNormalization(
367367
_ form: Unicode.CompatibilityNormalizationForm
368368
) -> String? {

Diff for: stdlib/public/core/UnicodeNormalizationCheck.swift

+24-24
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension Sequence<Unicode.Scalar> {
3030
/// aString.unicodeScalars.isNormalized(.nfc) // true
3131
/// ```
3232
///
33-
@available(SwiftStdlib 9999, *)
33+
// @available(SwiftStdlib 9999, *)
3434
@inlinable
3535
public consuming func isNormalized(
3636
_ form: Unicode.CanonicalNormalizationForm
@@ -53,7 +53,7 @@ extension Sequence<Unicode.Scalar> {
5353
/// aString.unicodeScalars.isNormalized(.nfc) // true
5454
/// ```
5555
///
56-
@available(SwiftStdlib 9999, *)
56+
// @available(SwiftStdlib 9999, *)
5757
@inlinable
5858
public consuming func isNormalized(
5959
_ form: Unicode.CompatibilityNormalizationForm
@@ -79,7 +79,7 @@ extension Collection<Unicode.Scalar> {
7979
/// aString.unicodeScalars.isNormalized(.nfc) // true
8080
/// ```
8181
///
82-
@available(SwiftStdlib 9999, *)
82+
// @available(SwiftStdlib 9999, *)
8383
@inlinable
8484
public func isNormalized(
8585
_ form: Unicode.CanonicalNormalizationForm
@@ -102,7 +102,7 @@ extension Collection<Unicode.Scalar> {
102102
/// aString.unicodeScalars.isNormalized(.nfc) // true
103103
/// ```
104104
///
105-
@available(SwiftStdlib 9999, *)
105+
// @available(SwiftStdlib 9999, *)
106106
@inlinable
107107
public func isNormalized(
108108
_ form: Unicode.CompatibilityNormalizationForm
@@ -128,7 +128,7 @@ extension StringProtocol {
128128
/// aString.isNormalized(.nfc) // true
129129
/// ```
130130
///
131-
@available(SwiftStdlib 9999, *)
131+
// @available(SwiftStdlib 9999, *)
132132
@_specialize(where Self == String)
133133
@_specialize(where Self == Substring)
134134
public func isNormalized(
@@ -149,7 +149,7 @@ extension StringProtocol {
149149
/// aString.isNormalized(.nfc) // true
150150
/// ```
151151
///
152-
@available(SwiftStdlib 9999, *)
152+
// @available(SwiftStdlib 9999, *)
153153
@_specialize(where Self == String)
154154
@_specialize(where Self == Substring)
155155
public func isNormalized(
@@ -173,7 +173,7 @@ extension Character {
173173
/// char.isNormalized(.nfc) // true
174174
/// ```
175175
///
176-
@available(SwiftStdlib 9999, *)
176+
// @available(SwiftStdlib 9999, *)
177177
public func isNormalized(
178178
_ form: Unicode.CanonicalNormalizationForm
179179
) -> Bool {
@@ -192,7 +192,7 @@ extension Character {
192192
/// char.isNormalized(.nfc) // true
193193
/// ```
194194
///
195-
@available(SwiftStdlib 9999, *)
195+
// @available(SwiftStdlib 9999, *)
196196
public func isNormalized(
197197
_ form: Unicode.CompatibilityNormalizationForm
198198
) -> Bool {
@@ -210,14 +210,14 @@ extension Unicode.Scalar {
210210

211211
// ABI barrier for data required by the NFD Quick Check algorithm.
212212

213-
@available(SwiftStdlib 9999, *)
213+
// @available(SwiftStdlib 9999, *)
214214
@usableFromInline
215215
internal typealias _NFDQuickCheckData = (
216216
CCC: Unicode.CanonicalCombiningClass,
217217
isNFDQC: Bool
218218
)
219219

220-
@available(SwiftStdlib 9999, *)
220+
// @available(SwiftStdlib 9999, *)
221221
@usableFromInline
222222
internal func _getNFDQuickCheckData() -> _NFDQuickCheckData {
223223
let normdata = Unicode._CanonicalNormData(self)
@@ -227,7 +227,7 @@ extension Unicode.Scalar {
227227

228228
extension Sequence<Unicode.Scalar> {
229229

230-
@available(SwiftStdlib 9999, *)
230+
// @available(SwiftStdlib 9999, *)
231231
@inlinable
232232
internal consuming func _isNFD() -> Bool {
233233

@@ -262,14 +262,14 @@ extension Unicode.Scalar {
262262

263263
// ABI barrier for data required by the NFKD Quick Check algorithm.
264264

265-
@available(SwiftStdlib 9999, *)
265+
// @available(SwiftStdlib 9999, *)
266266
@usableFromInline
267267
internal typealias _NFKDQuickCheckData = (
268268
CCC: Unicode.CanonicalCombiningClass,
269269
isNFKDQC: Bool
270270
)
271271

272-
@available(SwiftStdlib 9999, *)
272+
// @available(SwiftStdlib 9999, *)
273273
@usableFromInline
274274
internal func _getNFKDQuickCheckData() -> _NFKDQuickCheckData {
275275
let normdata = Unicode._CompatibilityNormData(self)
@@ -279,7 +279,7 @@ extension Unicode.Scalar {
279279

280280
extension Sequence<Unicode.Scalar> {
281281

282-
@available(SwiftStdlib 9999, *)
282+
// @available(SwiftStdlib 9999, *)
283283
@inlinable
284284
internal consuming func _isNFKD() -> Bool {
285285

@@ -314,14 +314,14 @@ extension Unicode.Scalar {
314314

315315
// ABI barrier for data required by the NFC Quick Check algorithm.
316316

317-
@available(SwiftStdlib 9999, *)
317+
// @available(SwiftStdlib 9999, *)
318318
@usableFromInline
319319
internal typealias _NFCQuickCheckData = (
320320
CCC: Unicode.CanonicalCombiningClass,
321321
isNFCQC: Unicode.NFCQCResult
322322
)
323323

324-
@available(SwiftStdlib 9999, *)
324+
// @available(SwiftStdlib 9999, *)
325325
@usableFromInline
326326
internal func _getNFCQuickCheckData() -> _NFCQuickCheckData {
327327
let normdata = Unicode._CanonicalNormData(onlyCCCAndNFCQC: self)
@@ -331,7 +331,7 @@ extension Unicode.Scalar {
331331

332332
extension Collection<Unicode.Scalar> {
333333

334-
@available(SwiftStdlib 9999, *)
334+
// @available(SwiftStdlib 9999, *)
335335
@inlinable @inline(never)
336336
internal func _isNFC() -> Bool {
337337

@@ -389,7 +389,7 @@ extension Collection<Unicode.Scalar> {
389389

390390
extension Sequence<Unicode.Scalar> {
391391

392-
@available(SwiftStdlib 9999, *)
392+
// @available(SwiftStdlib 9999, *)
393393
@inlinable @inline(never)
394394
internal consuming func _isNFC() -> Bool {
395395

@@ -451,7 +451,7 @@ extension Sequence<Unicode.Scalar> {
451451
}
452452
}
453453

454-
@available(SwiftStdlib 9999, *)
454+
// @available(SwiftStdlib 9999, *)
455455
@inlinable
456456
internal func _isNFC_sequence_slow(
457457
segment: some Collection<Unicode.Scalar>,
@@ -480,14 +480,14 @@ extension Unicode.Scalar {
480480

481481
// ABI barrier for data required by the NFKC Quick Check algorithm.
482482

483-
@available(SwiftStdlib 9999, *)
483+
// @available(SwiftStdlib 9999, *)
484484
@usableFromInline
485485
internal typealias _NFKCQuickCheckData = (
486486
CCC: Unicode.CanonicalCombiningClass,
487487
isNFKCQC: Unicode.NFCQCResult
488488
)
489489

490-
@available(SwiftStdlib 9999, *)
490+
// @available(SwiftStdlib 9999, *)
491491
@usableFromInline
492492
internal func _getNFKCQuickCheckData() -> _NFKCQuickCheckData {
493493
let normdata = Unicode._CompatibilityNormData(self)
@@ -497,7 +497,7 @@ extension Unicode.Scalar {
497497

498498
extension Collection<Unicode.Scalar> {
499499

500-
@available(SwiftStdlib 9999, *)
500+
// @available(SwiftStdlib 9999, *)
501501
@inlinable @inline(never)
502502
internal func _isNFKC() -> Bool {
503503

@@ -555,7 +555,7 @@ extension Collection<Unicode.Scalar> {
555555

556556
extension Sequence<Unicode.Scalar> {
557557

558-
@available(SwiftStdlib 9999, *)
558+
// @available(SwiftStdlib 9999, *)
559559
@inlinable @inline(never)
560560
internal consuming func _isNFKC() -> Bool {
561561

@@ -617,7 +617,7 @@ extension Sequence<Unicode.Scalar> {
617617
}
618618
}
619619

620-
@available(SwiftStdlib 9999, *)
620+
// @available(SwiftStdlib 9999, *)
621621
@inlinable
622622
internal func _isNFKC_sequence_slow(
623623
segment: some Collection<Unicode.Scalar>,

Diff for: stdlib/public/core/UnicodeScalar.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ extension Unicode.Scalar {
545545
/// Scalars which are unassigned in this version of Unicode
546546
/// may be meaningful to applications using a later version of the standard.
547547
///
548-
@available(SwiftStdlib 9999, *)
548+
// @available(SwiftStdlib 9999, *)
549549
public var isUnassigned: Bool {
550550

551551
// Accurate for Unicode 14.0 and later.

0 commit comments

Comments
 (0)