swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.58k stars 10.36k forks source link

It’s possible to write arbitrary text after specifying the @MainActor for a closure. #76540

Open omochi opened 1 month ago

omochi commented 1 month ago

Description

The following strange code compiles incorrectly:

Reproduction

Task { @MainActor(今日は日差しが強い) in
}

Expected behavior

It should result in some kind of error.

Environment

$ swift --version swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2) Target: arm64-apple-macosx15.0

Additional information

No response

AnthonyLatsis commented 1 month ago

A different test case:

let _: @MainActor(abcdef) () -> Void = {}