mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This patch updates the tests for the @completionHandlerAsync attribute. The main test is broken into three chunks; parsing, typechecking, and the decl assginment phases. For parsing, we verify both happy cases, with an explicitly provided completion handler index and one where it is omitted. We also verify the various ways that parsing can fail, with ill-formed names, missing parens etc.... The typechecking phase verifies that the function the attribute is attached to is not async, that it takes a completion handler, that the completion handler is a function type, is a function that returns Void, is @escaping, and is not @autoclosure. The decl assignment complains about the name not referencing an existing function, and the ambiguous naming of async functions.
6 lines
231 B
Swift
6 lines
231 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// expected-error@+1{{'completionHandlerAsync' attribute is only valid when experimental concurrency is enabled}}
|
|
@completionHandlerAsync("foobar", completionHandlerIndex: 1)
|
|
func func2() {}
|