File tree Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Original file line number Diff line number Diff line change @@ -432,33 +432,15 @@ extension UInt8? {
432
432
}
433
433
}
434
434
435
- /// Extends `Array` where Element is a FixedWidthInteger, providing initialization from a string of Unicode scalars.
436
- @_unavailableInEmbedded
437
- extension Array where Element: FixedWidthInteger {
438
- /// Initializes an array of Integers with Unicode scalars represented by the provided string.
439
- ///
440
- /// - Parameter scalars: A string containing Unicode scalars.
441
- @inlinable @_alwaysEmitIntoClient @_unavailableInEmbedded
442
- public init ( scalars: String ) {
443
- #if os(Linux) || os(iOS) || os(tvOS)
444
- // How to avoid the function body being type checked for embedded?
445
- self . init ( scalars. unicodeScalars. map { Element ( unicode: $0) } )
446
- #else
447
- self . init ( scalars. utf16. map { Element ( $0) } )
448
- #endif
449
- }
450
- }
451
-
452
435
/// Extends `FixedWidthInteger` providing initialization from a Unicode scalar.
453
436
extension FixedWidthInteger {
454
437
/// Initializes a FixedWidthInteger with the value of the provided Unicode scalar.
455
438
///
456
439
/// - Parameter unicode: The Unicode scalar to initialize from.
457
440
/// - Note: Construct with value `v.value`.
458
441
@inlinable @_alwaysEmitIntoClient
459
- public init ( unicode v: Unicode . Scalar ) {
460
- _precondition ( v. value <= Self . max,
461
- " Code point value does not fit into type " )
442
+ public init ? ( unicode v: Unicode . Scalar ) {
443
+ guard v. value <= Self . max else { return nil }
462
444
self = Self ( v. value)
463
445
}
464
446
}
You can’t perform that action at this time.
0 commit comments