Skip to content

Commit f9d3498

Browse files
committed
[Sema] Look through ActorIsolationErasureExpr when finding function DeclRefs for rethrows checking.
This conversion has no effect on `rethrows` checking and should be ignored. Resolves: rdar://142562250
1 parent 986e8b5 commit f9d3498

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ class AbstractFunction {
468468
// Look through optional evaluations.
469469
} else if (auto optionalEval = dyn_cast<OptionalEvaluationExpr>(fn)) {
470470
fn = optionalEval->getSubExpr()->getValueProvidingExpr();
471+
// Look through actor isolation erasures.
472+
} else if (auto actorIsolationErasure =
473+
dyn_cast<ActorIsolationErasureExpr>(fn)) {
474+
fn = actorIsolationErasure->getSubExpr()->getValueProvidingExpr();
471475
} else {
472476
break;
473477
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature DynamicActorIsolation -verify-additional-prefix swift6-
2+
// RUN: %target-typecheck-verify-swift -swift-version 6 -verify-additional-prefix swift6-
3+
4+
// REQUIRES: swift_feature_DynamicActorIsolation
5+
6+
// Tests related to DynamicActorIsolation feature
7+
8+
// rdar://142562250 - error: call can throw, but it is not marked with ‘try’ and the error is not handled
9+
@MainActor
10+
struct TestNoErrorsAboutThrows {
11+
struct Column {
12+
@MainActor
13+
init?(_ column: Int) {}
14+
}
15+
16+
func test(columns: [Int]) {
17+
// MainActor isolation erasure shouldn't interfere with effects checking
18+
_ = columns.compactMap(Column.init) // Ok
19+
}
20+
}

0 commit comments

Comments
 (0)