Open groue opened 1 month ago
The compiler changes its diagnostic depending on whether a closure argument is declared with or without argument label.
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.
No warning in both cases.
% 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
No response
Related: #75521
Description
The compiler changes its diagnostic depending on whether a closure argument is declared with or without argument label.
Reproduction
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