mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
25 lines
820 B
Swift
25 lines
820 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 5
|
|
|
|
func testNonacceptedClosures() {
|
|
let fn = { @usableFromInline in // expected-error{{attribute @usableFromInline is not supported on a closure}}
|
|
"hello"
|
|
}
|
|
|
|
let fn2: (Int) -> Int = { @usableFromInline x in // expected-error{{attribute @usableFromInline is not supported on a closure}}
|
|
print("hello")
|
|
return x
|
|
}
|
|
|
|
_ = fn
|
|
_ = fn2
|
|
|
|
// https://github.com/swiftlang/swift/issues/76291
|
|
_ = { (@objc x: Int) in 0 } // expected-error {{'@objc' attribute cannot be applied to this declaration}}
|
|
_ = { (@objc x: Int) in } // expected-error {{'@objc' attribute cannot be applied to this declaration}}
|
|
|
|
_ = { (@objc x: Int) in // expected-error {{'@objc' attribute cannot be applied to this declaration}}
|
|
print("hello")
|
|
return x
|
|
}
|
|
}
|