Skip to content

Commit c8b6989

Browse files
committed
Parameterized Existential Types Are Enabled By Default
See https://forums.swift.org/t/accepted-se-0353-constrained-existential-types/57560
1 parent 863da1b commit c8b6989

16 files changed

+17
-32
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,6 @@ namespace swift {
338338
/// in calls to generic functions.
339339
bool EnableOpenedExistentialTypes = false;
340340

341-
/// Enable support for parameterized protocol types in existential
342-
/// position.
343-
bool EnableParameterizedExistentialTypes = false;
344-
345341
/// Enable experimental flow-sensitive concurrent captures.
346342
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;
347343

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,6 @@ def enable_explicit_existential_types :
543543
Flag<["-"], "enable-explicit-existential-types">,
544544
HelpText<"Enable experimental support for explicit existential types">;
545545

546-
def enable_parameterized_existential_types :
547-
Flag<["-"], "enable-parameterized-existential-types">,
548-
HelpText<"Enable experimental support for parameterized existential types">;
549-
550546
def enable_experimental_opened_existential_types :
551547
Flag<["-"], "enable-experimental-opened-existential-types">,
552548
HelpText<"Enable experimental support for implicitly opened existentials">;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
448448
Opts.EnableExperimentalNamedOpaqueTypes |=
449449
Args.hasArg(OPT_enable_experimental_named_opaque_types);
450450

451-
Opts.EnableParameterizedExistentialTypes |=
452-
Args.hasArg(OPT_enable_parameterized_existential_types);
453-
454451
Opts.EnableOpenedExistentialTypes =
455452
Args.hasFlag(OPT_enable_experimental_opened_existential_types,
456453
OPT_disable_experimental_opened_existential_types,

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static Type applyGenericArguments(Type type, TypeResolution resolution,
632632
// Build ParameterizedProtocolType if the protocol has a primary associated
633633
// type and we're in a supported context (for now just generic requirements,
634634
// inheritance clause, extension binding).
635-
if (!resolution.getOptions().isParameterizedProtocolSupported(ctx.LangOpts)) {
635+
if (!resolution.getOptions().isParameterizedProtocolSupported()) {
636636
diags.diagnose(loc, diag::parameterized_protocol_not_supported);
637637
return ErrorType::get(ctx);
638638
}

lib/Sema/TypeCheckType.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,14 @@ class TypeResolutionOptions {
284284
}
285285

286286
/// Whether parameterized protocol types are supported in this context.
287-
///
288-
/// FIXME: Remove LangOptions parameter once EnableParameterizedExistentialTypes
289-
/// staging flag is gone.
290-
bool isParameterizedProtocolSupported(const LangOptions &opts) const {
287+
bool isParameterizedProtocolSupported() const {
291288
switch (context) {
292289
case Context::Inherited:
293290
case Context::ExtensionBinding:
294291
case Context::GenericRequirement:
295-
return true;
296292
case Context::ExistentialConstraint:
297293
case Context::MetatypeBase:
298-
return opts.EnableParameterizedExistentialTypes;
294+
return true;
299295
case Context::None:
300296
case Context::TypeAliasDecl:
301297
case Context::GenericTypeAliasDecl:

test/Constraints/parameterized_existential_metatypes.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 -enable-parameterized-existential-types -disable-availability-checking
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking
22
//
33
// FIXME: Merge this file with existential_metatypes.swift once -enable-parameterized-existential-types becomes the default
44

test/IRGen/existential_shape_metadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-ir %s -swift-version 5 -disable-availability-checking -enable-parameterized-existential-types | %IRGenFileCheck %s
1+
// RUN: %target-swift-frontend -emit-ir %s -swift-version 5 -disable-availability-checking | %IRGenFileCheck %s
22

33
// CHECK-LABEL: @"$sl26existential_shape_metadata2Q0_pyxXPXGMq" = linkonce_odr hidden constant
44
// CHECK-SAME: { i32 {{.*}}sub ([[INT]] ptrtoint (i8** @{{[0-9]+}} to [[INT]])

test/Interpreter/parameterized_existentials.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-parameterized-existential-types -Xfrontend -disable-availability-checking)
1+
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking)
22
// REQUIRES: executable_test
33

44
import StdlibUnittest

test/RemoteAST/parameterized_existentials.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-remoteast-test -enable-parameterized-existential-types -disable-availability-checking %s | %FileCheck %s
1+
// RUN: %target-swift-remoteast-test -disable-availability-checking %s | %FileCheck %s
22

33
// REQUIRES: swift-remoteast-test
44

test/SILGen/parameterized_existentials.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-emit-silgen -module-name parameterized -enable-parameterized-existential-types -disable-availability-checking %s | %FileCheck %s
1+
// RUN: %target-swift-emit-silgen -module-name parameterized -disable-availability-checking %s | %FileCheck %s
22

33
protocol P<T, U, V> {
44
associatedtype T

0 commit comments

Comments
 (0)