mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #59740 from hborla/remove-existential-opening-option
[LangOptions] Remove the option to enable/disable implicit existential opening.
This commit is contained in:
@@ -317,10 +317,6 @@ namespace swift {
|
|||||||
/// Enable experimental concurrency model.
|
/// Enable experimental concurrency model.
|
||||||
bool EnableExperimentalConcurrency = false;
|
bool EnableExperimentalConcurrency = false;
|
||||||
|
|
||||||
/// Enable support for implicitly opening existential argument types
|
|
||||||
/// in calls to generic functions.
|
|
||||||
bool EnableOpenedExistentialTypes = false;
|
|
||||||
|
|
||||||
/// Disable experimental ClangImporter diagnostics.
|
/// Disable experimental ClangImporter diagnostics.
|
||||||
bool DisableExperimentalClangImporterDiagnostics = false;
|
bool DisableExperimentalClangImporterDiagnostics = false;
|
||||||
|
|
||||||
|
|||||||
@@ -450,11 +450,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||||||
Opts.EnableExperimentalConcurrency |=
|
Opts.EnableExperimentalConcurrency |=
|
||||||
Args.hasArg(OPT_enable_experimental_concurrency);
|
Args.hasArg(OPT_enable_experimental_concurrency);
|
||||||
|
|
||||||
Opts.EnableOpenedExistentialTypes =
|
|
||||||
Args.hasFlag(OPT_enable_experimental_opened_existential_types,
|
|
||||||
OPT_disable_experimental_opened_existential_types,
|
|
||||||
true);
|
|
||||||
|
|
||||||
Opts.EnableInferPublicSendable |=
|
Opts.EnableInferPublicSendable |=
|
||||||
Args.hasFlag(OPT_enable_infer_public_concurrent_value,
|
Args.hasFlag(OPT_enable_infer_public_concurrent_value,
|
||||||
OPT_disable_infer_public_concurrent_value,
|
OPT_disable_infer_public_concurrent_value,
|
||||||
|
|||||||
@@ -1519,10 +1519,6 @@ shouldOpenExistentialCallArgument(
|
|||||||
if (isa_and_nonnull<clang::FunctionTemplateDecl>(callee->getClangDecl()))
|
if (isa_and_nonnull<clang::FunctionTemplateDecl>(callee->getClangDecl()))
|
||||||
return None;
|
return None;
|
||||||
|
|
||||||
ASTContext &ctx = callee->getASTContext();
|
|
||||||
if (!ctx.LangOpts.EnableOpenedExistentialTypes)
|
|
||||||
return None;
|
|
||||||
|
|
||||||
// The actual parameter type needs to involve a type variable, otherwise
|
// The actual parameter type needs to involve a type variable, otherwise
|
||||||
// type inference won't be possible.
|
// type inference won't be possible.
|
||||||
if (!paramTy->hasTypeVariable())
|
if (!paramTy->hasTypeVariable())
|
||||||
|
|||||||
@@ -482,6 +482,11 @@ TypeChecker::getTypeOfCompletionOperator(DeclContext *DC, Expr *LHS,
|
|||||||
// Build temporary expression to typecheck.
|
// Build temporary expression to typecheck.
|
||||||
// We allocate these expressions on the stack because we know they can't
|
// We allocate these expressions on the stack because we know they can't
|
||||||
// escape and there isn't a better way to allocate scratch Expr nodes.
|
// escape and there isn't a better way to allocate scratch Expr nodes.
|
||||||
|
|
||||||
|
// Use a placeholder expr for the LHS argument to avoid sending
|
||||||
|
// a pre-type-checked AST through the constraint system.
|
||||||
|
OpaqueValueExpr argExpr(LHS->getSourceRange(), LHSTy,
|
||||||
|
/*isPlaceholder=*/true);
|
||||||
UnresolvedDeclRefExpr UDRE(DeclNameRef(opName), refKind, DeclNameLoc(Loc));
|
UnresolvedDeclRefExpr UDRE(DeclNameRef(opName), refKind, DeclNameLoc(Loc));
|
||||||
auto *opExpr = TypeChecker::resolveDeclRefExpr(
|
auto *opExpr = TypeChecker::resolveDeclRefExpr(
|
||||||
&UDRE, DC, /*replaceInvalidRefsWithErrors=*/true);
|
&UDRE, DC, /*replaceInvalidRefsWithErrors=*/true);
|
||||||
@@ -493,7 +498,7 @@ TypeChecker::getTypeOfCompletionOperator(DeclContext *DC, Expr *LHS,
|
|||||||
// (declref_expr name=<opName>)
|
// (declref_expr name=<opName>)
|
||||||
// (argument_list
|
// (argument_list
|
||||||
// (<LHS>)))
|
// (<LHS>)))
|
||||||
auto *postfixExpr = PostfixUnaryExpr::create(ctx, opExpr, LHS);
|
auto *postfixExpr = PostfixUnaryExpr::create(ctx, opExpr, &argExpr);
|
||||||
return getTypeOfCompletionOperatorImpl(DC, postfixExpr, referencedDecl);
|
return getTypeOfCompletionOperatorImpl(DC, postfixExpr, referencedDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +509,7 @@ TypeChecker::getTypeOfCompletionOperator(DeclContext *DC, Expr *LHS,
|
|||||||
// (<LHS>)
|
// (<LHS>)
|
||||||
// (code_completion_expr)))
|
// (code_completion_expr)))
|
||||||
CodeCompletionExpr dummyRHS(Loc);
|
CodeCompletionExpr dummyRHS(Loc);
|
||||||
auto *binaryExpr = BinaryExpr::create(ctx, LHS, opExpr, &dummyRHS,
|
auto *binaryExpr = BinaryExpr::create(ctx, &argExpr, opExpr, &dummyRHS,
|
||||||
/*implicit*/ true);
|
/*implicit*/ true);
|
||||||
return getTypeOfCompletionOperatorImpl(DC, binaryExpr, referencedDecl);
|
return getTypeOfCompletionOperatorImpl(DC, binaryExpr, referencedDecl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// RUN: %target-typecheck-verify-swift
|
// RUN: %target-typecheck-verify-swift
|
||||||
// RUN: %target-typecheck-verify-swift -enable-experimental-opened-existential-types
|
|
||||||
|
|
||||||
protocol P { }
|
protocol P { }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// RUN: %target-typecheck-verify-swift -enable-experimental-opened-existential-types
|
// RUN: %target-typecheck-verify-swift
|
||||||
|
|
||||||
protocol Q { }
|
protocol Q { }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// RUN: %target-swift-frontend -enable-experimental-opened-existential-types -typecheck -dump-ast -parse-as-library %s | %FileCheck %s
|
// RUN: %target-swift-frontend -typecheck -dump-ast -parse-as-library %s | %FileCheck %s
|
||||||
|
|
||||||
protocol P { }
|
protocol P { }
|
||||||
extension Optional: P where Wrapped: P { }
|
extension Optional: P where Wrapped: P { }
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50
|
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50
|
||||||
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50 -enable-experimental-opened-existential-types
|
|
||||||
|
|
||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// RUN: %target-typecheck-verify-swift -enable-objc-interop -disable-experimental-opened-existential-types
|
// RUN: %target-typecheck-verify-swift -enable-objc-interop
|
||||||
|
|
||||||
protocol P { }
|
protocol P { }
|
||||||
@objc protocol OP { }
|
@objc protocol OP { }
|
||||||
@@ -8,14 +8,14 @@ protocol CP : class { }
|
|||||||
static func createNewOne() -> SP
|
static func createNewOne() -> SP
|
||||||
}
|
}
|
||||||
|
|
||||||
func fP<T : P>(_ t: T) { }
|
func fP<T : P>(_ t: T?) { }
|
||||||
// expected-note@-1 {{required by global function 'fP' where 'T' = 'any P'}}
|
// expected-note@-1 {{required by global function 'fP' where 'T' = 'any P'}}
|
||||||
// expected-note@-2 {{required by global function 'fP' where 'T' = 'any OP & P'}}
|
// expected-note@-2 {{required by global function 'fP' where 'T' = 'any OP & P'}}
|
||||||
func fOP<T : OP>(_ t: T) { }
|
func fOP<T : OP>(_ t: T?) { }
|
||||||
// expected-note@-1 {{required by global function 'fOP' where 'T' = 'any OP & P'}}
|
// expected-note@-1 {{required by global function 'fOP' where 'T' = 'any OP & P'}}
|
||||||
func fOPE(_ t: OP) { }
|
func fOPE(_ t: OP) { }
|
||||||
func fSP<T : SP>(_ t: T) { }
|
func fSP<T : SP>(_ t: T?) { }
|
||||||
func fAO<T : AnyObject>(_ t: T) { }
|
func fAO<T : AnyObject>(_ t: T?) { }
|
||||||
// expected-note@-1 {{where 'T' = 'any P'}}
|
// expected-note@-1 {{where 'T' = 'any P'}}
|
||||||
// expected-note@-2 {{where 'T' = 'any CP'}}
|
// expected-note@-2 {{where 'T' = 'any CP'}}
|
||||||
// expected-note@-3 {{where 'T' = 'any OP & P'}}
|
// expected-note@-3 {{where 'T' = 'any OP & P'}}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop)
|
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop)
|
||||||
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xfrontend -enable-experimental-opened-existential-types)
|
|
||||||
//
|
|
||||||
// REQUIRES: executable_test
|
// REQUIRES: executable_test
|
||||||
|
|
||||||
import FunctionTemplates
|
import FunctionTemplates
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// RUN: %target-swift-emit-silgen -enable-experimental-opened-existential-types %s | %FileCheck %s
|
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
|
||||||
|
|
||||||
public protocol P { }
|
public protocol P { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user