diff --git a/lib/SILOptimizer/Utils/SILIsolationInfo.cpp b/lib/SILOptimizer/Utils/SILIsolationInfo.cpp index 91fc48c5634ca..631dc5c29f742 100644 --- a/lib/SILOptimizer/Utils/SILIsolationInfo.cpp +++ b/lib/SILOptimizer/Utils/SILIsolationInfo.cpp @@ -128,8 +128,9 @@ bool DeclRefExprAnalysis::compute(Expr *expr) { return Action::Stop(); } - if (isa( - expr)) { + // TODO: is this right? + if (isa(expr)) { parentAnalysis.lookThroughExprs.push_back(expr); return Action::Continue(expr); } diff --git a/test/Concurrency/transfernonsendable_sending_params.swift b/test/Concurrency/transfernonsendable_sending_params.swift index f8024bc575571..38f3e54bc3f47 100644 --- a/test/Concurrency/transfernonsendable_sending_params.swift +++ b/test/Concurrency/transfernonsendable_sending_params.swift @@ -3079,3 +3079,16 @@ func testNonSendableCaptures(ns: NonSendableKlass, a: isolated MyActor) { let _ = ns } } + +// https://github.com/swiftlang/swift/issues/84376 + +@MainActor +class NonFinalMainActorClass { + var nonSendableState: [NonSendableKlass] = [] + + func testClassMethodSubscriptLookupPropagatesIsolation() { + let alias = nonSendableState[0] + transferArg(alias) // expected-warning {{sending 'alias' risks causing data races}} + // expected-note @-1 {{main actor-isolated 'alias' is passed as a 'sending' parameter; Uses in callee may race with later main actor-isolated uses}} + } +}