mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Previously we would only call this in the delayed application logic, which is currently run for multi-statement closures. I'm planning on removing that code path, which uncovered this issue.
25 lines
802 B
Swift
25 lines
802 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 5
|
|
|
|
func testNonacceptedClosures() {
|
|
let fn = { @usableFromInline in // expected-error{{'usableFromInline' is not supported on a closure}}
|
|
"hello"
|
|
}
|
|
|
|
let fn2: (Int) -> Int = { @usableFromInline x in // expected-error{{'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
|
|
}
|
|
}
|