False positive warning about closure isolation but only when argument label is omitted
Description
The compiler changes its diagnostic depending on whether a closure argument is declared with or without argument label.
Reproduction
struct SUT {
func run1(completion: sending @escaping () -> Void) { }
func run2(_ completion: sending @escaping () -> Void) { }
}
@MainActor
func test_run() {
let sut = SUT()
// No warning
sut.run1 { }
// Main actor-isolated value of type '() -> ()' passed as a strongly
// transferred parameter; later accesses could race
sut.run2 { }
}
This is very confusing.
Expected behavior
No warning in both cases.
Environment
% swiftc -version swift-driver version: 1.112.3 Apple Swift version 6.0 (swiftlang-6.0.0.6.8 clang-1600.0.23.1) Target: arm64-apple-macosx14.0
Additional information
No response
Related: #75521
@groue so this doesn't reproduce on main anymore. It was fixed in
tags/swift-DEVELOPMENT-SNAPSHOT-2024-08-28-a..tags/swift-DEVELOPMENT-SNAPSHOT-2024-08-29-a.
So one of these commits:
406b8bd8921 Merge pull request #76133 from slavapestov/sync-local-func-isolation 543fd214940 Merge pull request #76125 from ian-twilightcoder/unknown-platform-attr 8503f72b11e Merge pull request #76111 from tshortli/lazy-typecheck-lazy-var-in-inlinable-func dfa60a1c809 Merge pull request #76101 from kateinoigakukun/yt/update-swift-collection-113 3436c49ee43 Merge pull request #76123 from hamishknight/a-form-of-expression 6465bdc6e13 Merge pull request #76042 from xedin/rdar-133415157 00eee36ea72 Merge pull request #76115 from xedin/rdar-131524246
Thank you @gottesmm :-) Glad the bug is fixed in the latest snapshot, because it is still there in Xcode 16.1 beta 3. #75521 is a similar issue.
This is fixed in the 6.1 release.