Skip to content

Commit 329d584

Browse files
authored
Merge pull request #60431 from angela-laar/enable-existential-any
Enforce existential `any` behind a feature flag
2 parents 2aa47b8 + b9c5ebe commit 329d584

File tree

5 files changed

+381
-1
lines changed

5 files changed

+381
-1
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)"
9393
UPCOMING_FEATURE(ConciseMagicFile, 274, 6)
9494
UPCOMING_FEATURE(ForwardTrailingClosures, 286, 6)
9595
UPCOMING_FEATURE(BareSlashRegexLiterals, 354, 6)
96+
UPCOMING_FEATURE(ExistentialAny, 335, 6)
9697

9798
EXPERIMENTAL_FEATURE(StaticAssert)
9899
EXPERIMENTAL_FEATURE(VariadicGenerics)

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3010,6 +3010,10 @@ static bool usesFeatureConciseMagicFile(Decl *decl) {
30103010
return false;
30113011
}
30123012

3013+
static bool usesFeatureExistentialAny(Decl *decl) {
3014+
return false;
3015+
}
3016+
30133017
static bool usesFeatureForwardTrailingClosures(Decl *decl) {
30143018
return false;
30153019
}

lib/Sema/TypeCheckDecl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,10 @@ ExistentialConformsToSelfRequest::evaluate(Evaluator &evaluator,
708708
bool
709709
ExistentialRequiresAnyRequest::evaluate(Evaluator &evaluator,
710710
ProtocolDecl *decl) const {
711+
auto &ctx = decl->getASTContext();
712+
if (ctx.LangOpts.hasFeature(Feature::ExistentialAny))
713+
return true;
714+
711715
// ObjC protocols do not require `any`.
712716
if (decl->isObjC())
713717
return false;

test/Concurrency/actor_isolation_swift6.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func checkIsolationValueType(_ formance: InferredFromConformance,
5959
_ = await anno.counter // expected-warning {{no 'async' operations occur within 'await' expression}}
6060

6161
// these do need await, regardless of reference or value type
62-
_ = await (formance as MainCounter).counter
62+
_ = await (formance as any MainCounter).counter
6363
_ = await ext[1]
6464
_ = await formance.ticker
6565
_ = await ext.polygon

0 commit comments

Comments
 (0)