Files
swift-mirror/test/Concurrency/objc_async_overload.swift
Evan Wilde 3da0a540eb Update tests
This patch updates all the tests to accept the new error messages.
*Gack* so many things needed cleaning up.
2021-04-24 07:51:18 -07:00

32 lines
1.1 KiB
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-concurrency -typecheck -verify -import-objc-header %S/Inputs/Delegate.h %s
// REQUIRES: concurrency
// REQUIRES: objc_interop
// overload resolution should pick sync version in a sync context
func syncContext() {
let r = Request()
let d = Delegate()
d.makeRequest1(r) // NOTE: this use to trigger an overload resolution error, see SR-13760
d.makeRequest2(r)
d.makeRequest3(r)
}
// overload resolution should pick async version in an async context
func asyncNoAwait() async {
let r = Request()
let d = Delegate()
d.makeRequest1(r) // expected-error@:3 {{expression is 'async' but is not marked with 'await'}} expected-note {{call is 'async'}}
d.makeRequest2(r) // expected-error@:3 {{expression is 'async' but is not marked with 'await'}} expected-note {{call is 'async'}}
d.makeRequest3(r) // expected-error@:3 {{expression is 'async' but is not marked with 'await'}} expected-note {{call is 'async'}}
}
func asyncWithAwait() async {
let r = Request()
let d = Delegate()
await d.makeRequest1(r)
await d.makeRequest2(r)
await d.makeRequest3(r)
}