Skip to content

Commit 2fc11ed

Browse files
committed
stdlib: Fix a borrowing switch condfail.
Resolves rdar://128249510
1 parent 161b245 commit 2fc11ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stdlib/public/core/Optional.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ extension Optional where Wrapped: ~Copyable {
230230
public borrowing func _borrowingMap<U: ~Copyable, E: Error>(
231231
_ transform: (borrowing Wrapped) throws(E) -> U
232232
) throws(E) -> U? {
233-
#if $NoncopyableGenerics
233+
#if compiler(>=6.0) && $NoncopyableGenerics
234234
switch self {
235235
case .some(_borrowing y):
236236
return .some(try transform(y))
@@ -289,7 +289,6 @@ extension Optional {
289289
}
290290
}
291291

292-
@_disallowFeatureSuppression(NoncopyableGenerics)
293292
extension Optional where Wrapped: ~Copyable {
294293
// FIXME(NCG): Make this public.
295294
@_alwaysEmitIntoClient
@@ -309,12 +308,16 @@ extension Optional where Wrapped: ~Copyable {
309308
public func _borrowingFlatMap<U: ~Copyable, E: Error>(
310309
_ transform: (borrowing Wrapped) throws(E) -> U?
311310
) throws(E) -> U? {
311+
#if compiler(>=6.0) && $NoncopyableGenerics
312312
switch self {
313313
case .some(_borrowing y):
314314
return try transform(y)
315315
case .none:
316316
return .none
317317
}
318+
#else
319+
fatalError("Unsupported compiler")
320+
#endif
318321
}
319322
}
320323

0 commit comments

Comments
 (0)