Skip to content

Commit bf7091f

Browse files
committed
ensure #if $MoveOnly evaluates to true
I enabled move-only types by default, but I didn't realize that the `Feature::MoveOnly` needs to graduate into a `LANGUAGE_FEATURE` so that `EvaluateIfConfigCondition` will recognize `$MoveOnly` as being true. fixes rdar://107050387
1 parent 21701ac commit bf7091f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(
9898
FreestandingExpressionMacros, 382, "Expression macros",
9999
true)
100100
LANGUAGE_FEATURE(AttachedMacros, 389, "Attached macros", true)
101+
LANGUAGE_FEATURE(MoveOnly, 390, "noncopyable types", true)
101102

102103
UPCOMING_FEATURE(ConciseMagicFile, 274, 6)
103104
UPCOMING_FEATURE(ForwardTrailingClosures, 286, 6)
@@ -108,7 +109,6 @@ EXPERIMENTAL_FEATURE(StaticAssert, false)
108109
EXPERIMENTAL_FEATURE(VariadicGenerics, false)
109110
EXPERIMENTAL_FEATURE(NamedOpaqueTypes, false)
110111
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures, false)
111-
EXPERIMENTAL_FEATURE(MoveOnly, true)
112112
EXPERIMENTAL_FEATURE(FreestandingMacros, true)
113113

114114
// FIXME: MoveOnlyClasses is not intended to be in production,

test/ModuleInterface/moveonly_interface_flag.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -enable-experimental-feature MoveOnly
2+
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library
33
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t
44
// RUN: %FileCheck %s < %t/Library.swiftinterface
55

66
// this test makes sure that decls containing a move-only type are guarded by the $MoveOnly feature flag
77

8-
// CHECK: swift-module-flags-ignorable: -enable-experimental-feature MoveOnly
9-
108
// CHECK: #if compiler(>=5.3) && $MoveOnly
119
// CHECK-NEXT: @_moveOnly public struct MoveOnlyStruct {
1210

@@ -40,5 +38,3 @@ public class What {
4038
public extension MoveOnlyStruct {
4139
func who() {}
4240
}
43-
44-

test/Sema/moveonly_experimental.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ func checkNoImplicitCopy2(_ x: SomeValue) {
3131
checkNoImplicitCopy2(y)
3232
}
3333

34+
// coverage to ensure the feature flag is working
35+
#if $MoveOnly
36+
func guardedFn() {}
37+
#endif
38+
39+
func caller() {
40+
guardedFn()
41+
}
3442

3543

3644

0 commit comments

Comments
 (0)