mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Also '#error', '#warning', and '#sourceLocation'.
Other call-like syntax (call expression, macro expansion, and custom
attribtues) requires '(' on the same line as the callee. For consistency,
built-in attributes and built-in directives should also ignore '(' on
next line.
45 lines
1.6 KiB
Swift
45 lines
1.6 KiB
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
@ MainActor // expected-warning {{extraneous whitespace between '@' and attribute name; this is an error in the Swift 6 language mode}}
|
|
class Foo {
|
|
func funcWithEscapingClosure(_ x: @ escaping () -> Int) {} // expected-warning {{extraneous whitespace between '@' and attribute name; this is an error in the Swift 6 language mode}}
|
|
}
|
|
|
|
@available (*, deprecated) // expected-warning {{extraneous whitespace between attribute name and '('; this is an error in the Swift 6 language mode}}
|
|
func deprecated() {}
|
|
|
|
@propertyWrapper
|
|
struct MyPropertyWrapper {
|
|
var wrappedValue: Int = 1
|
|
|
|
init(param: Int) {}
|
|
}
|
|
|
|
struct PropertyWrapperTest {
|
|
@MyPropertyWrapper (param: 2) // expected-warning {{extraneous whitespace between attribute name and '('; this is an error in the Swift 6 language mode}}
|
|
var x: Int
|
|
|
|
@MyPropertyWrapper
|
|
(param: 2) // expected-error {{expected 'var' keyword in property declaration}} expected-error {{property declaration does not bind any variables}} expected-error {{expected pattern}}
|
|
var y: Int
|
|
}
|
|
|
|
let closure1 = { @MainActor (a, b) in // expected-warning {{extraneous whitespace between attribute name and '('; this is an error in the Swift 6 language mode}}
|
|
}
|
|
|
|
let closure2 = { @MainActor
|
|
(a: Int, b: Int) in
|
|
}
|
|
|
|
// expected-warning@+1{{extraneous whitespace between '@' and attribute name; this is an error in the Swift 6 language mode}}
|
|
@
|
|
MainActor
|
|
func mainActorFunc() {}
|
|
|
|
|
|
@inline // expected-error {{expected '(' in 'inline' attribute}}
|
|
(never) func neverInline() {} // expected-error {{expected declaration}}
|
|
|
|
@objc
|
|
(whatever) func whateverObjC() {} // expected-error {{expected declaration}}
|