mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
In Swift 6 and later, whitespace is no longer permitted between an
attribute name and the opening parenthesis. Update the parser so that
in Swift 6+, a `(` without preceding whitespace is always treated as
the start of the argument list, while a '(' with preceding whitespace is
considered the start of the argument list _only when_ it is unambiguous.
This change makes the following closure be parsed correctly:
{ @MainActor (arg: Int) in ... }
rdar://147785544
11 lines
254 B
Swift
11 lines
254 B
Swift
// RUN: %target-swift-frontend -parse -verify %s
|
|
|
|
func test1() {
|
|
@s
|
|
return // expected-error {{expected declaration}}
|
|
}
|
|
func test2() {
|
|
@unknown // expected-error {{unknown attribute 'unknown'}}
|
|
return // expected-error {{expected declaration}}
|
|
}
|