Skip to content

[6.1][Sema] Look through ActorIsolationErasureExpr when finding function… #78536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/Sema/TypeCheckEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ class AbstractFunction {
// 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;
}
Expand Down
20 changes: 20 additions & 0 deletions test/Concurrency/dynamic_actor_isolation.swift
Original file line number Diff line number Diff line change
@@ -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
}
}