File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -1338,11 +1338,18 @@ shouldOpenExistentialCallArgument(
1338
1338
if (!callee)
1339
1339
return None;
1340
1340
1341
- // _openExistential handles its own opening.
1342
- if (TypeChecker::getDeclTypeCheckingSemantics(callee) ==
1343
- DeclTypeCheckingSemantics::OpenExistential)
1341
+ // Special semantics prohibit opening existentials.
1342
+ switch (TypeChecker::getDeclTypeCheckingSemantics(callee)) {
1343
+ case DeclTypeCheckingSemantics::OpenExistential:
1344
+ case DeclTypeCheckingSemantics::TypeOf:
1345
+ // type(of:) and _openExistential handle their own opening.
1344
1346
return None;
1345
1347
1348
+ case DeclTypeCheckingSemantics::Normal:
1349
+ case DeclTypeCheckingSemantics::WithoutActuallyEscaping:
1350
+ break;
1351
+ }
1352
+
1346
1353
ASTContext &ctx = callee->getASTContext();
1347
1354
if (!ctx.LangOpts.EnableOpenedExistentialTypes)
1348
1355
return None;
Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift
2
+ // RUN: %target-typecheck-verify-swift -enable-experimental-opened-existential-types
2
3
3
4
protocol P { }
4
5
You can’t perform that action at this time.
0 commit comments