[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
This commit is contained in:
Pavel Yaskevich
2025-01-09 16:06:56 -08:00
parent 986e8b554d
commit f9d34984c6
2 changed files with 24 additions and 0 deletions

View File

@@ -468,6 +468,10 @@ public:
// Look through optional evaluations.
} else if (auto optionalEval = dyn_cast<OptionalEvaluationExpr>(fn)) {
fn = optionalEval->getSubExpr()->getValueProvidingExpr();
// Look through actor isolation erasures.
} else if (auto actorIsolationErasure =
dyn_cast<ActorIsolationErasureExpr>(fn)) {
fn = actorIsolationErasure->getSubExpr()->getValueProvidingExpr();
} else {
break;
}

View File

@@ -0,0 +1,20 @@
// RUN: %target-typecheck-verify-swift -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature DynamicActorIsolation -verify-additional-prefix swift6-
// RUN: %target-typecheck-verify-swift -swift-version 6 -verify-additional-prefix swift6-
// REQUIRES: swift_feature_DynamicActorIsolation
// Tests related to DynamicActorIsolation feature
// rdar://142562250 - error: call can throw, but it is not marked with try and the error is not handled
@MainActor
struct TestNoErrorsAboutThrows {
struct Column {
@MainActor
init?(_ column: Int) {}
}
func test(columns: [Int]) {
// MainActor isolation erasure shouldn't interfere with effects checking
_ = columns.compactMap(Column.init) // Ok
}
}