Skip to content

Commit 333ae3f

Browse files
committed
Add experimental feature for one-way closure parameters
1 parent b012270 commit 333ae3f

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ EXPERIMENTAL_FEATURE(VariadicGenerics)
8888
EXPERIMENTAL_FEATURE(NamedOpaqueTypes)
8989
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures)
9090
EXPERIMENTAL_FEATURE(MoveOnly)
91+
EXPERIMENTAL_FEATURE(OneWayClosureParameters)
9192

9293
#undef EXPERIMENTAL_FEATURE
9394
#undef SUPPRESSIBLE_LANGUAGE_FEATURE

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,10 +721,6 @@ namespace swift {
721721
/// Disable constraint system performance hacks.
722722
bool DisableConstraintSolverPerformanceHacks = false;
723723

724-
/// Enable experimental support for one-way constraints for the
725-
/// parameters of closures.
726-
bool EnableOneWayClosureParameters = false;
727-
728724
/// See \ref FrontendOptions.PrintFullConvention
729725
bool PrintFullConvention = false;
730726
};

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,6 +3015,10 @@ static bool usesFeatureMoveOnly(Decl *decl) {
30153015
return false;
30163016
}
30173017

3018+
static bool usesFeatureOneWayClosureParameters(Decl *decl) {
3019+
return false;
3020+
}
3021+
30183022
static void
30193023
suppressingFeatureNoAsyncAvailability(PrintOptions &options,
30203024
llvm::function_ref<void()> action) {

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
661661
Opts.Features.insert(Feature::FlowSensitiveConcurrencyCaptures);
662662
if (Args.hasArg(OPT_enable_experimental_move_only))
663663
Opts.Features.insert(Feature::MoveOnly);
664+
if (Args.hasArg(OPT_experimental_one_way_closure_params))
665+
Opts.Features.insert(Feature::OneWayClosureParameters);
664666

665667
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
666668

@@ -1111,9 +1113,6 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
11111113
// Always enable operator designated types for the standard library.
11121114
Opts.EnableOperatorDesignatedTypes |= FrontendOpts.ParseStdlib;
11131115

1114-
Opts.EnableOneWayClosureParameters |=
1115-
Args.hasArg(OPT_experimental_one_way_closure_params);
1116-
11171116
Opts.PrintFullConvention |=
11181117
Args.hasArg(OPT_experimental_print_full_convention);
11191118

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9874,7 +9874,7 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
98749874
// type as seen in the body of the closure and the external parameter
98759875
// type.
98769876
bool oneWayConstraints =
9877-
getASTContext().TypeCheckerOpts.EnableOneWayClosureParameters ||
9877+
getASTContext().LangOpts.hasFeature(Feature::OneWayClosureParameters) ||
98789878
resultBuilderType;
98799879

98809880
auto *paramList = closure->getParameters();

0 commit comments

Comments
 (0)