Commit Graph

26 Commits

Author SHA1 Message Date
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
Pavel Yaskevich
f5e672e985 Merge pull request #37216 from xedin/rdar-70610141
[Diagnostics] Improve diagnostics when passing `async` to a sync parameter
2021-05-05 10:10:05 -07:00
Pavel Yaskevich
0e9c33e47f [Sema] Suppress concurrency related diagnostics for invalid AST nodes
Expressions that failed type-check can't be correctly analyzed by
effects checker due to missing type and overload choice information.

Resolves: rdar://76475495
2021-05-04 14:25:07 -07:00
Pavel Yaskevich
c842773450 [Diagnostics] Re-phrase note about inferred async effect from an operation in a closure body 2021-05-04 10:09:03 -07:00
Pavel Yaskevich
886a8ab6b7 [Diagnostics] Improve diagnostics when passing async to a sync parameter
If `async` effect has been inferred from the body of the closure,
let's find out the first occurrence of `async` node and point it out
to make it clear why closure is `async`.

Resolves: rdar://70610141
2021-05-03 11:08:36 -07:00
Konrad `ktoso` Malawski
34f8e768b5 spawnDetached to detach, non-suspending group.spawn, spawnUnlessCancelled 2021-04-03 09:53:32 +09:00
Konrad `ktoso` Malawski
6e746304e1 [Concurrency] Update Task and Group APIs based on Review 1 2021-04-03 09:52:03 +09:00
Mike Ash
1173b737aa [Concurrency] Add availability to Concurrency APIs.
This allows programs to target older OSes while using Concurrency behind an availability check. When targeting older OSes, the symbols are weak-linked and the compiler will require the use of Concurrency features to be guarded by an availability check.

rdar://75850003
2021-04-01 10:42:08 -04:00
Jonathan Grynspan
36b03a499f Merge pull request #35868 from grynspan/main
[Concurrency] Simplify the type story for `Continuation` by eliminating `Throwing` variants
2021-02-12 12:55:13 -05:00
Konrad `ktoso` Malawski
a55ebff942 [Concurrency] deprecate not implemented Task functions, until they're implemented 2021-02-12 16:33:16 +09:00
Jonathan Grynspan
d8f7f20c4b [Concurrency] Simplify the type story for Continuation by eliminating Throwing variants
The goal of doing this is to reduce the amount of boilerplate and repeated code w.r.t. Continuation. Having just added `resume()` in four places, I got the sense that there was a lot of common code that was being duplicated. I removed the Throwing variants of these types (they can be expressed as Continuation<T, E:Error> instead of ThrowingContinuation<E>) and I broke out a significant amount of common code between CheckedContinuation and UnsafeContinuation into an implementation-only protocol to avoid repeating it. D.R.Y.

This change resolves rdar://74154769.
2021-02-10 12:09:33 -05:00
Slava Pestov
c54f19c8da Sema: Fix preservation of DiagnoseErrorOnTry flag
This fixes a regression from some over-eager logic introduced by my commit
5d6cf5cd96.

We need to be careful to preserve this flag only in cases where the
throwing-ness bubbles up from the nested ContextScope, namely AwaitExpr
and InterpolatedStringLiteralExpr.

Fixes <rdar://problem/72748150>.
2021-01-08 18:15:11 -05:00
Kavon Farvardin
fabd45e7c3 [concurrency] add resume<E: Error>(with: Result<T, E>) to UnsafeThrowingContinuation
A handy overload that allows one to return a Result<> to
a continuation without needing to manually unwrap it in client code.

Resolves rdar://71870249
2021-01-06 15:01:14 -08:00
Doug Gregor
3c38ffe0ea [Concurrency] await try -> try await
The `try await` ordering is both easier to read and indicates the order
of operations better, because the suspension point occurs first and
then one can observe a thrown error.
2020-12-23 13:21:59 -08:00
Doug Gregor
3e11edef42 Update test case for withUnsafe(Throwing)Continuation. 2020-12-11 16:41:08 -08:00
Doug Gregor
18ef1869f3 [Concurrency] Diagnose "try await" with a Fix-It 2020-12-04 00:57:18 -08:00
Doug Gregor
50cdddaf95 [Concurrency] Enable implicit conversion from synchronous -> asynchronous. 2020-12-03 12:44:21 -08:00
Joe Groff
f922eb237c Coalesce multiple Unsafe*Continuation definitions.
We somehow ended up with a set hidden in `Task` as well as a set at top level. SILGen currently
hooks into the top-level ones, so shed the `Task`-namespaced versions for now.
2020-11-19 09:05:11 -08:00
Konrad `ktoso` Malawski
107bc27c96 [Concurrency] Remove Handle.Failure, since we do not use it as get() is always throwing currently;
There is no meaningful way to restrict the error type (or expect it for that matter.
2020-10-28 17:04:06 +09:00
Konrad `ktoso` Malawski
3e261781e3 [concurrency] task is only a namespace after all; remove Task.current() 2020-10-28 16:54:52 +09:00
Konrad `ktoso` Malawski
0ccc5e5145 [Concurrency] Add extra test for unsafe continuations; showcasing typical usage 2020-10-28 11:20:38 +09:00
Konrad `ktoso` Malawski
b5fd2a5c56 Address review comments; get() must throw, formatting 2020-10-27 11:30:53 +09:00
Konrad `ktoso` Malawski
579c89c222 [Concurrency] More documentation of Task.Priority 2020-10-26 19:02:07 +09:00
Konrad `ktoso` Malawski
d6adac3172 [Concurrency] Stubs for Task.current() 2020-10-26 19:02:07 +09:00
Konrad `ktoso` Malawski
07f80bed64 [Concurrency] API stubs: Task.Handle, priority and runDetached 2020-10-26 19:02:07 +09:00
Konrad `ktoso` Malawski
9023e56bd9 [Concurrency] Add minimal placeholders for Task and UnsafeContinuation 2020-10-26 19:02:02 +09:00