You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// after all: if you have async code, just call it directly, without the unsafe continuation
54
-
let _:String=withUnsafeContinuation{ continuation in // expected-error{{cannot pass function of type '(UnsafeContinuation<String, Never>) async -> Void' to parameter expecting synchronous function type}}
55
-
lets=awaitsomeAsyncFunc() // expected-note {{'async' inferred from asynchronous operation used here}}
54
+
#if ALLOW_TYPECHECKER_ERRORS
55
+
let _:String=withUnsafeContinuation{ continuation in // expected-typechecker-error{{cannot pass function of type '(UnsafeContinuation<String, Never>) async -> Void' to parameter expecting synchronous function type}}
56
+
lets=awaitsomeAsyncFunc() // expected-typechecker-note {{'async' inferred from asynchronous operation used here}}
56
57
continuation.resume(returning: s)
57
58
}
59
+
#endif
58
60
59
61
let _:String=awaitwithUnsafeContinuation{ continuation in
60
62
continuation.resume(returning:"")
61
63
}
62
64
63
65
// rdar://76475495 - suppress warnings for invalid expressions
66
+
#if ALLOW_TYPECHECKER_ERRORS
64
67
func test_invalid_async_no_warnings()async->Int{
65
68
returnawaitwithUnsafeContinuation{
66
-
$0.resume(throwing:1) // expected-error {{cannot convert value of type 'Int' to expected argument type 'Never'}}
69
+
$0.resume(throwing:1) // expected-typechecker-error {{cannot convert value of type 'Int' to expected argument type 'Never'}}
0 commit comments