Skip to content

Commit a21984e

Browse files
authored
Merge pull request #60805 from gottesmm/pr-be37496f2562a6683d2f616f6301d8fbb6884c53
Put @_moveOnly type attribute behind the move only experimental flag.
2 parents 9fc19fb + f46ed6b commit a21984e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,13 @@ void AttributeChecker::visitFinalAttr(FinalAttr *attr) {
19581958
}
19591959

19601960
void AttributeChecker::visitMoveOnlyAttr(MoveOnlyAttr *attr) {
1961+
if (!D->getASTContext().LangOpts.hasFeature(Feature::MoveOnly)) {
1962+
auto error =
1963+
diag::experimental_moveonly_feature_can_only_be_used_when_enabled;
1964+
diagnoseAndRemoveAttr(attr, error);
1965+
return;
1966+
}
1967+
19611968
if (isa<NominalTypeDecl>(D))
19621969
return;
19631970

test/Sema/moveonly_decl_attr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -parse-stdlib -disable-availability-checking -verify-syntax-tree
1+
// RUN: %target-typecheck-verify-swift -parse-stdlib -disable-availability-checking -verify-syntax-tree -enable-experimental-move-only
22

33
import Swift
44

0 commit comments

Comments
 (0)