Skip to content

Commit 34a5e41

Browse files
author
John Holdsworth
committed
Remove Array initialiser.
1 parent c234ef4 commit 34a5e41

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

stdlib/public/core/UnicodeScalar.swift

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -432,33 +432,15 @@ extension UInt8? {
432432
}
433433
}
434434

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-
452435
/// Extends `FixedWidthInteger` providing initialization from a Unicode scalar.
453436
extension FixedWidthInteger {
454437
/// Initializes a FixedWidthInteger with the value of the provided Unicode scalar.
455438
///
456439
/// - Parameter unicode: The Unicode scalar to initialize from.
457440
/// - Note: Construct with value `v.value`.
458441
@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 }
462444
self = Self(v.value)
463445
}
464446
}

0 commit comments

Comments
 (0)