Skip to content

Commit 72c9289

Browse files
committed
Introduce feature ForwardTrailingClosures for SE-0286.
Replace the "Swift version 6" checks for forward-scanning trailing closure matching with checks for this new feature.
1 parent 2fbe202 commit 72c9289

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(UnavailableFromAsync, 0, "@_unavailableFromAsync",
9090
SUPPRESSIBLE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)", true)
9191

9292
FUTURE_FEATURE(ConciseMagicFile, 274, 6)
93+
FUTURE_FEATURE(ForwardTrailingClosures, 286, 6)
9394

9495
EXPERIMENTAL_FEATURE(StaticAssert)
9596
EXPERIMENTAL_FEATURE(VariadicGenerics)

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,6 +3027,10 @@ static bool usesFeatureTypeWitnessSystemInference(Decl *decl) {
30273027
return false;
30283028
}
30293029

3030+
static bool usesFeatureForwardTrailingClosures(Decl *decl) {
3031+
return false;
3032+
}
3033+
30303034
static void
30313035
suppressingFeatureNoAsyncAvailability(PrintOptions &options,
30323036
llvm::function_ref<void()> action) {

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static bool matchCallArgumentsImpl(
472472
// way to successfully match arguments to parameters.
473473
if (!parameterRequiresArgument(params, paramInfo, paramIdx) &&
474474
!param.getPlainType()->getASTContext().LangOpts
475-
.isSwiftVersionAtLeast(6) &&
475+
.hasFeature(Feature::ForwardTrailingClosures) &&
476476
anyParameterRequiresArgument(
477477
params, paramInfo, paramIdx + 1,
478478
nextArgIdx + 1 < numArgs
@@ -934,7 +934,7 @@ static bool requiresBothTrailingClosureDirections(
934934

935935
// If backward matching is disabled, only scan forward.
936936
ASTContext &ctx = params.front().getPlainType()->getASTContext();
937-
if (ctx.LangOpts.isSwiftVersionAtLeast(6))
937+
if (ctx.LangOpts.hasFeature(Feature::ForwardTrailingClosures))
938938
return false;
939939

940940
// If there are at least two parameters that meet the backward scan's

0 commit comments

Comments
 (0)