Files
swift-mirror/test/attr/attr_completionhandlerasync_con_disabled.swift
Evan Wilde 5b17c7c3c4 Updating tests for @completionHandlerAsync
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.
2021-03-13 13:38:15 -08:00

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() {}