Skip to content

Commit 972373b

Browse files
committed
NCGenerics: begin process of removing compat hack
The reverse-condfail workaround needs to be removed, and this is the first step to allowing the stdlib to build with conditionally escapable types. resolves rdar://132453000
1 parent 72ad780 commit 972373b

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ EXPERIMENTAL_FEATURE(DebugDescriptionMacro, true)
392392

393393
EXPERIMENTAL_FEATURE(ReinitializeConsumeInMultiBlockDefer, false)
394394

395-
EXPERIMENTAL_FEATURE(SE427NoInferenceOnExtension, false)
395+
EXPERIMENTAL_FEATURE(SE427NoInferenceOnExtension, true)
396396

397397
EXPERIMENTAL_FEATURE(Extern, true)
398398

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ function(_compile_swift_files
627627

628628
list(APPEND swift_flags "-enable-experimental-feature" "NoncopyableGenerics2")
629629
list(APPEND swift_flags "-enable-experimental-feature" "SuppressedAssociatedTypes")
630+
list(APPEND swift_flags "-enable-experimental-feature" "SE427NoInferenceOnExtension")
630631

631632
if(SWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES)
632633
list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes")

test/ModuleInterface/Inputs/NoncopyableGenerics_Misc.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,12 @@ public struct RegularTwice: ~Copyable, ~Copyable {}
142142
public struct Continuation<T: ~Copyable, E: Error> {
143143
public func resume(returning value: consuming T) where E == Never {}
144144
}
145+
146+
// coverage for rdar://132453000 (Can't make a type both conditionally Copyable and conditionally Escapable)
147+
@frozen
148+
public enum Moptional<Wrapped: ~Copyable & ~Escapable>: ~Copyable, ~Escapable {
149+
case none
150+
case some(Wrapped)
151+
}
152+
extension Moptional: Copyable where Wrapped: Copyable {}
153+
extension Moptional: Escapable where Wrapped: Escapable {}

test/ModuleInterface/noncopyable_generics.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// RUN: %empty-directory(%t)
22

3-
// Due to SE427NoInferenceOnExtension not being in production
4-
// REQUIRES: asserts
5-
63
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -emit-module \
74
// RUN: -enable-experimental-feature SuppressedAssociatedTypes \
85
// RUN: -enable-experimental-feature NonescapableTypes \
@@ -159,6 +156,11 @@ import NoncopyableGenerics_Misc
159156
// CHECK-MISC-NEXT: }
160157

161158
// CHECK-MISC-NEXT: public struct Continuation<T, E> where E : Swift.Error, T : ~Copyable {
159+
160+
// CHECK-MISC: @frozen public enum Moptional<Wrapped> : ~Swift.Copyable, ~Swift.Escapable where Wrapped : ~Copyable, Wrapped : ~Escapable {
161+
// CHECK-MISC: extension {{.*}}.Moptional : Swift.Copyable where Wrapped : Swift.Copyable {
162+
// CHECK-MISC: extension {{.*}}.Moptional : Swift.Escapable where Wrapped : Swift.Escapable {
163+
162164
// CHECK-MISC-NOT: ~
163165

164166
// NOTE: below are extensions emitted at the end of NoncopyableGenerics_Misc.swift

0 commit comments

Comments
 (0)