Commit Graph

8 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
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
Slava Pestov
d6db99a442 Sema: Fix effects checking of 'for await' with a concrete conformance
AsyncSequence is only polymorphic over 'throws' effects, not 'async',
because it is @rethrows and not @reasync. So the logic here was wrong,
and it would incorrectly conclude that a 'for await' with a concrete
conformance did not require the outer function to be 'async'.

Fixes rdar://problem/75436909.
2021-04-05 18:26:36 -04: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
Slava Pestov
286927d2aa Sema: Fix effect checking bug with 'for try await'
Previously we diagnosed here if a thrown error was
unhandled, but we also have to set the flag, otherwise
we produce a warning saying that a 'do/catch' has
no throwing operations in its body.

Fixes rdar://problem/75274975.
2021-03-22 16:54:53 -04:00
Philippe Hausler
00f6af1372 Remove potential for duplicate diagnosis on rethrows 2021-02-04 13:18:27 -08:00
Philippe Hausler
9a3d613345 [Sema] Corrections for for-await-in syntax to prevent specific bad code-gen scenarios and improve diagnostics
SILGen verification crash when no other async functions are called in a function body not marked as async when a for-await-in syntax is used. This corrects the diagnostics to ensure that the type check effects sees the proper async call that the for-await-in syntax infers.

for-await-in syntax was missing a diagnistic hint for inserting a try when the protocol conformance of the sequence shows a potential of throwing. (also there was a superfluous check for the nominal type in that type check (which was removed).

for-await-in syntax and for-try-await-in syntax did not infer async or throwing to closure constraints, both were added to properly identify the asyncy-ness/throwy-ness of the iteration.
2021-02-04 09:22:05 -08:00