Skip to content

Commit aea947d

Browse files
committed
Remove staging flag for unimplemented key path components.
All the originally-planned component kinds are now implemented.
1 parent 61cc148 commit aea947d

File tree

12 files changed

+8
-28
lines changed

12 files changed

+8
-28
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,6 @@ namespace swift {
238238
/// Diagnose uses of NSCoding with classes that have unstable mangled names.
239239
bool EnableNSKeyedArchiverDiagnostics = true;
240240

241-
/// Enable keypath components that aren't fully implemented.
242-
bool EnableExperimentalKeyPathComponents = false;
243-
244241
/// When a conversion from String to Substring fails, emit a fix-it to append
245242
/// the void subscript '[]'.
246243
/// FIXME: Remove this flag when void subscripts are implemented.

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,6 @@ def enable_experimental_property_behaviors :
279279
Flag<["-"], "enable-experimental-property-behaviors">,
280280
HelpText<"Enable experimental property behaviors">;
281281

282-
def enable_experimental_keypath_components :
283-
Flag<["-"], "enable-experimental-keypath-components">,
284-
HelpText<"Enable unimplemented keypath component kinds">;
285-
286282
def enable_deserialization_recovery :
287283
Flag<["-"], "enable-deserialization-recovery">,
288284
HelpText<"Attempt to recover from missing xrefs (etc) in swiftmodules">;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
945945
Opts.EnableExperimentalPropertyBehaviors |=
946946
Args.hasArg(OPT_enable_experimental_property_behaviors);
947947

948-
Opts.EnableExperimentalKeyPathComponents |=
949-
Args.hasArg(OPT_enable_experimental_keypath_components);
950-
951948
Opts.EnableClassResilience |=
952949
Args.hasArg(OPT_enable_class_resilience);
953950

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,12 +1453,6 @@ void PreCheckExpression::resolveKeyPathExpr(KeyPathExpr *KPE) {
14531453

14541454
expr = UDE->getBase();
14551455
} else if (auto SE = dyn_cast<SubscriptExpr>(expr)) {
1456-
if (!TC.Context.LangOpts.EnableExperimentalKeyPathComponents) {
1457-
TC.diagnose(SE->getLoc(),
1458-
diag::expr_swift_keypath_unimplemented_component,
1459-
"subscript");
1460-
}
1461-
14621456
// .[0] or just plain [0]
14631457
components.push_back(
14641458
KeyPathExpr::Component::forUnresolvedSubscriptWithPrebuiltIndexExpr(

test/SILGen/keypath_application.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -enable-experimental-keypath-components -emit-silgen %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
22

33
class A {}
44
class B {}

test/SILGen/keypaths.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -enable-experimental-keypath-components -emit-silgen %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
22

33
struct S<T> {
44
var x: T

test/SILGen/keypaths_objc.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-keypath-components -emit-silgen -import-objc-header %S/Inputs/keypaths_objc.h %s | %FileCheck %s
2-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-keypath-components -emit-ir -import-objc-header %S/Inputs/keypaths_objc.h %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -import-objc-header %S/Inputs/keypaths_objc.h %s | %FileCheck %s
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -import-objc-header %S/Inputs/keypaths_objc.h %s
33
// REQUIRES: objc_interop
44

55
import Foundation

test/expr/unary/keypath/keypath-unimplemented.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ class C {
99
var i = 0
1010
}
1111

12-
func unsupportedComponents() {
13-
_ = \A.[0] // expected-error{{key path support for subscript components is not implemented}}
14-
}
15-
1612
// rdar://problem/32209039 - Improve diagnostic when unsupported tuple element references are used in key path literals
1713
let _ = \(Int, String).0 // expected-error {{key path cannot reference tuple elements}}
1814
let _ = \(a: Int, b: String).b // expected-error {{key path cannot reference tuple elements}}

test/expr/unary/keypath/keypath.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -typecheck -parse-as-library -enable-experimental-keypath-components %s -verify
1+
// RUN: %target-swift-frontend -typecheck -parse-as-library %s -verify
22

33
struct Sub: Hashable {
44
static func ==(_: Sub, _: Sub) -> Bool { return true }

test/stdlib/KeyPath.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %s -Xfrontend -enable-experimental-keypath-components -o %t/a.out
2+
// RUN: %target-build-swift %s -o %t/a.out
33
// RUN: %target-run %t/a.out
44
// REQUIRES: executable_test
55

test/stdlib/KeyPathImplementation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %s -g -Xfrontend -enable-experimental-keypath-components -o %t/a.out
2+
// RUN: %target-build-swift %s -g -o %t/a.out
33
// RUN: %target-run %t/a.out
44
// REQUIRES: executable_test
55

test/stdlib/KeyPathObjC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %s -Xfrontend -enable-experimental-keypath-components -o %t/a.out
2+
// RUN: %target-build-swift %s -o %t/a.out
33
// RUN: %target-run %t/a.out
44
// REQUIRES: executable_test
55
// REQUIRES: objc_interop

0 commit comments

Comments
 (0)