Skip to content

[move-keyword] Put the move keyword behind the experimental move only flag for now. #60493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/Sema/MiscDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,13 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
}

void checkMoveExpr(MoveExpr *moveExpr) {
// Make sure the MoveOnly feature is set. If not, error.
if (!Ctx.LangOpts.hasFeature(Feature::MoveOnly)) {
auto error =
diag::experimental_moveonly_feature_can_only_be_used_when_enabled;
Ctx.Diags.diagnose(moveExpr->getLoc(), error);
}

if (!isa<DeclRefExpr>(moveExpr->getSubExpr())) {
Ctx.Diags.diagnose(moveExpr->getLoc(),
diag::move_expression_not_passed_lvalue);
Expand Down
4 changes: 2 additions & 2 deletions test/DebugInfo/move_function_dbginfo.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -parse-as-library -g -emit-ir -o - %s | %FileCheck %s
// RUN: %target-swift-frontend -parse-as-library -g -c %s -o %t/out.o
// RUN: %target-swift-frontend -enable-experimental-move-only -parse-as-library -g -emit-ir -o - %s | %FileCheck %s
// RUN: %target-swift-frontend -enable-experimental-move-only -parse-as-library -g -c %s -o %t/out.o
// RUN: %llvm-dwarfdump --show-children %t/out.o | %FileCheck -check-prefix=DWARF %s

// This test checks that:
Expand Down
6 changes: 3 additions & 3 deletions test/DebugInfo/move_function_dbginfo_async.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -parse-as-library -disable-availability-checking -g -emit-sil -o - %s | %FileCheck -check-prefix=SIL %s
// RUN: %target-swift-frontend -parse-as-library -disable-availability-checking -g -emit-ir -o - %s | %FileCheck %s
// RUN: %target-swift-frontend -parse-as-library -disable-availability-checking -g -c %s -o %t/out.o
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-move-only -disable-availability-checking -g -emit-sil -o - %s | %FileCheck -check-prefix=SIL %s
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-move-only -disable-availability-checking -g -emit-ir -o - %s | %FileCheck %s
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-move-only -disable-availability-checking -g -c %s -o %t/out.o
// RUN: %llvm-dwarfdump --show-children %t/out.o | %FileCheck -check-prefix=DWARF %s

// This test checks that:
Expand Down
2 changes: 1 addition & 1 deletion test/Parse/move_expr.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -disable-availability-checking
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-move-only

var global: Int = 5
func testGlobal() {
Expand Down
2 changes: 1 addition & 1 deletion test/Sema/move_expr.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -disable-availability-checking
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-move-only

class Klass {
var k: Klass? = nil
Expand Down
2 changes: 1 addition & 1 deletion test/stdlib/LifetimeManagement.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-run-simple-swift
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-move-only)

// REQUIRES: executable_test

Expand Down
2 changes: 1 addition & 1 deletion test/stdlib/move_function.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-run-stdlib-swift(-Xllvm -sil-disable-pass=DestroyHoisting)
// RUN: %target-run-stdlib-swift(-Xllvm -sil-disable-pass=DestroyHoisting -Xfrontend -enable-experimental-move-only)
//
// NOTE ON ABOVE: I am disabling destroy hoisting on this test since we are
// going to move it out of the mandatory pipeline eventually and it causes the
Expand Down