Skip to content

Commit 663722d

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 0b74559 commit 663722d

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
@@ -326,10 +326,6 @@ namespace swift {
326326
/// in calls to generic functions.
327327
bool EnableOpenedExistentialTypes = false;
328328

329-
/// Enable support for parameterized protocol types in existential
330-
/// position.
331-
bool EnableParameterizedExistentialTypes = false;
332-
333329
/// Enable experimental flow-sensitive concurrent captures.
334330
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;
335331

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
@@ -456,9 +456,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
456456
Opts.EnableExperimentalNamedOpaqueTypes |=
457457
Args.hasArg(OPT_enable_experimental_named_opaque_types);
458458

459-
Opts.EnableParameterizedExistentialTypes |=
460-
Args.hasArg(OPT_enable_parameterized_existential_types);
461-
462459
Opts.EnableOpenedExistentialTypes =
463460
Args.hasFlag(OPT_enable_experimental_opened_existential_types,
464461
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
// This test requires the new existential shape metadata accessors which are

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

test/SILOptimizer/cast_folding_parameterized_protocol.swift

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

33
public protocol P<T> {
44
associatedtype T

test/Sema/availability_parameterized_existential.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50 -disable-objc-attr-requires-foundation-module -enable-parameterized-existential-types
2-
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx10.50 -disable-objc-attr-requires-foundation-module -enable-parameterized-existential-types -typecheck %s 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
1+
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50 -disable-objc-attr-requires-foundation-module
2+
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx10.50 -disable-objc-attr-requires-foundation-module -typecheck %s 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
33

44
// Make sure we do not emit availability errors or warnings when -disable-availability-checking is passed
5-
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx10.50 -typecheck -disable-objc-attr-requires-foundation-module -enable-parameterized-existential-types -disable-availability-checking %s 2>&1 | %FileCheck %s '--implicit-check-not=error:'
5+
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx10.50 -typecheck -disable-objc-attr-requires-foundation-module -disable-availability-checking %s 2>&1 | %FileCheck %s '--implicit-check-not=error:'
66

77
// REQUIRES: OS=macosx
88

test/Serialization/parameterized_protocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -enable-parameterized-existential-types -emit-module %S/Inputs/parameterized_protocol_other.swift -emit-module-path %t/parameterized_protocol_other.swiftmodule
3-
// RUN: %target-typecheck-verify-swift -enable-parameterized-existential-types -I%t
2+
// RUN: %target-swift-frontend -emit-module %S/Inputs/parameterized_protocol_other.swift -emit-module-path %t/parameterized_protocol_other.swiftmodule
3+
// RUN: %target-typecheck-verify-swift -I%t
44

55
import parameterized_protocol_other
66

test/type/opaque_parameterized_existential.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-parameterized-existential-types -disable-availability-checking -typecheck -verify %s
1+
// RUN: %target-swift-frontend -disable-availability-checking -typecheck -verify %s
22

33
// I do not like nested some type params,
44
// I do not like them Σam-i-am

test/type/parameterized_existential.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 -disable-availability-checking -enable-parameterized-existential-types
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking
22

33
protocol Sequence<Element> {
44
associatedtype Element

validation-test/compiler_crashers_2_fixed/unsupported_recursive_opaque_conformance.swift

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

33
protocol P<X, Y> {
44
associatedtype X : P

0 commit comments

Comments
 (0)