Skip to content

Commit 0e4ddbd

Browse files
authored
Merge pull request #41446 from hborla/remove-explicit-existential-flag
[FrontendOptions] Remove the -enable-explicit-existential-types flag.
2 parents b2d3eed + c2594d1 commit 0e4ddbd

16 files changed

+3
-151
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4707,10 +4707,6 @@ ERROR(any_not_existential,none,
47074707
ERROR(existential_requires_any,none,
47084708
"protocol %0 as a type must be explicitly marked as 'any'",
47094709
(Identifier))
4710-
ERROR(explicit_existential_not_supported,none,
4711-
"explicit 'any' not supported; use frontend flag "
4712-
"-enable-explicit-existential-types to enable this feature",
4713-
())
47144710

47154711
ERROR(nonisolated_let,none,
47164712
"'nonisolated' is meaningless on 'let' declarations because "

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,6 @@ namespace swift {
313313
/// `func f() -> <T> T`.
314314
bool EnableExperimentalNamedOpaqueTypes = false;
315315

316-
/// Enable support for explicit existential types via the \c any
317-
/// keyword.
318-
bool EnableExplicitExistentialTypes = true;
319-
320316
/// Enable support for protocol types parameterized by primary
321317
/// associated type.
322318
bool EnableParameterizedProtocolTypes = false;

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4256,9 +4256,6 @@ ProtocolType::ProtocolType(ProtocolDecl *TheDecl, Type Parent,
42564256

42574257
Type ExistentialType::get(Type constraint) {
42584258
auto &C = constraint->getASTContext();
4259-
if (!C.LangOpts.EnableExplicitExistentialTypes)
4260-
return constraint;
4261-
42624259
// FIXME: Any and AnyObject don't yet use ExistentialType.
42634260
if (constraint->isAny() || constraint->isAnyObject())
42644261
return constraint;

lib/Frontend/CompilerInvocation.cpp

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

448-
Opts.EnableExplicitExistentialTypes |=
449-
Args.hasArg(OPT_enable_explicit_existential_types);
450-
451448
Opts.EnableParameterizedProtocolTypes |=
452449
Args.hasArg(OPT_enable_parameterized_protocol_types);
453450

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ class EqualUpToClangTypes
9898
};
9999

100100
static bool equalWithoutExistentialTypes(Type t1, Type t2) {
101-
if (!t1->getASTContext().LangOpts.EnableExplicitExistentialTypes)
102-
return false;
103-
104101
auto withoutExistentialTypes = [](Type type) -> Type {
105102
return type.transform([](Type type) -> Type {
106103
if (auto existential = type->getAs<ExistentialType>())

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,8 +2989,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
29892989
// metatype with the same constraint type as its existential operand.
29902990
auto formalInstanceTy
29912991
= MI->getType().castTo<ExistentialMetatypeType>().getInstanceType();
2992-
if (M->getASTContext().LangOpts.EnableExplicitExistentialTypes &&
2993-
formalInstanceTy->isConstraintType() &&
2992+
if (formalInstanceTy->isConstraintType() &&
29942993
!(formalInstanceTy->isAny() || formalInstanceTy->isAnyObject())) {
29952994
require(MI->getOperand()->getType().is<ExistentialType>(),
29962995
"existential_metatype operand must be an existential type");

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,11 +2142,6 @@ NeverNullType TypeResolver::resolveType(TypeRepr *repr,
21422142
}
21432143

21442144
case TypeReprKind::Existential: {
2145-
if (!getASTContext().LangOpts.EnableExplicitExistentialTypes &&
2146-
!(options & TypeResolutionFlags::SilenceErrors)) {
2147-
diagnose(repr->getLoc(), diag::explicit_existential_not_supported);
2148-
}
2149-
21502145
auto *existential = cast<ExistentialTypeRepr>(repr);
21512146
return resolveExistentialType(existential, options);
21522147
}
@@ -4145,7 +4140,7 @@ class ExistentialTypeVisitor
41454140
}
41464141

41474142
void visitIdentTypeRepr(IdentTypeRepr *T) {
4148-
if (T->isInvalid() || !Ctx.LangOpts.EnableExplicitExistentialTypes)
4143+
if (T->isInvalid())
41494144
return;
41504145

41514146
auto comp = T->getComponentRange().back();

test/ClangImporter/objc_bridging_generics.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -parse-as-library -verify -swift-version 4 -I %S/Inputs/custom-modules %s
2-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -parse-as-library -enable-explicit-existential-types -verify -swift-version 4 -I %S/Inputs/custom-modules %s
32

43
// REQUIRES: objc_interop
54

test/Constraints/common_type_objc.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s -debug-constraints 2>%t.err
22
// RUN: %FileCheck %s < %t.err
33

4-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -enable-explicit-existential-types %s -debug-constraints 2>%t.err
5-
// RUN: %FileCheck %s < %t.err
6-
74
// REQUIRES: objc_interop
85

96
import Foundation

test/Constraints/openExistential.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-typecheck-verify-swift
2-
// RUN: %target-typecheck-verify-swift -enable-explicit-existential-types
32

43
protocol P { }
54

test/Constraints/protocols.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-typecheck-verify-swift
2-
// RUN: %target-typecheck-verify-swift -enable-explicit-existential-types
32

43
protocol Fooable { func foo() }
54
protocol Barable { func bar() }

test/SILGen/protocol_with_superclass.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
22
// RUN: %target-swift-frontend -emit-ir %s
33

4-
// RUN: %target-swift-emit-silgen -enable-explicit-existential-types %s | %FileCheck %s
5-
// RUN: %target-swift-frontend -emit-ir -enable-explicit-existential-types %s
6-
74
// Protocols with superclass-constrained Self.
85

96
class Concrete {

test/SILGen/subclass_existentials.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// RUN: %target-swift-emit-silgen -module-name subclass_existentials -Xllvm -sil-full-demangle -parse-as-library -primary-file %s -verify | %FileCheck %s
33
// RUN: %target-swift-emit-ir -module-name subclass_existentials -parse-as-library -primary-file %s
44

5-
// RUN: %target-swift-emit-silgen -module-name subclass_existentials -Xllvm -sil-full-demangle -parse-as-library -enable-explicit-existential-types -primary-file %s -verify | %FileCheck %s
6-
// RUN: %target-swift-emit-ir -module-name subclass_existentials -parse-as-library -enable-explicit-existential-types -primary-file %s
7-
85
// Note: we pass -verify above to ensure there are no spurious
96
// compiler warnings relating to casts.
107

test/Sema/type_join.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-typecheck-verify-swift -parse-stdlib
2-
// RUN: %target-typecheck-verify-swift -parse-stdlib -enable-explicit-existential-types
32

43
import Swift
54

test/TypeDecoder/explicit_existentials.swift

Lines changed: 0 additions & 112 deletions
This file was deleted.

test/type/explicit_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 -enable-explicit-existential-types
1+
// RUN: %target-typecheck-verify-swift
22

33
protocol HasSelfRequirements {
44
func foo(_ x: Self)

0 commit comments

Comments
 (0)