Skip to content

Commit c2d33b4

Browse files
committed
[stdlib] Take out generalization of Optional.unsafelyUnwrapped for now
1 parent 26176cc commit c2d33b4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

stdlib/public/core/Optional.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ extension Optional where Wrapped: ~Copyable {
320320
}
321321
}
322322

323-
extension Optional where Wrapped: ~Escapable {
323+
extension Optional {
324324
/// The wrapped value of this instance, unwrapped without checking whether
325325
/// the instance is `nil`.
326326
///
@@ -345,9 +345,11 @@ extension Optional where Wrapped: ~Escapable {
345345
/// will never be equal to `nil` and only after you've tried using the
346346
/// postfix `!` operator.
347347
@inlinable
348-
@_preInverseGenerics
349348
@unsafe
350349
public var unsafelyUnwrapped: Wrapped {
350+
// FIXME: Generalize this for ~Escapable wrapped types. Unfortunately this
351+
// currently hides it from C++ interop, breaking the stdlib overlay.
352+
// (rdar://145800780)
351353
@inline(__always)
352354
get {
353355
if let x = self {

test/api-digester/Outputs/stability-stdlib-source-base.swift.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ Struct CollectionOfOne is now with @_addressableForDependencies
367367
Protocol CodingKey has added inherited protocol SendableMetatype
368368
Protocol Error has added inherited protocol SendableMetatype
369369

370-
Accessor Optional.unsafelyUnwrapped.Get() has generic signature change from <Wrapped> to <Wrapped where Wrapped : ~Escapable>
371370
Accessor UnsafeBufferPointer.indices.Get() has generic signature change from <Element> to <Element where Element : ~Copyable>
372371
Accessor UnsafeMutableBufferPointer.indices.Get() has generic signature change from <Element> to <Element where Element : ~Copyable>
373372

0 commit comments

Comments
 (0)