Commit Graph

64 Commits

Author SHA1 Message Date
Erik Eckstein
72fc4e3c95 docs: document the existing @_effects() attributes 2022-01-25 11:29:25 +01:00
Evan Wilde
d99e3318db Add implementation of _unavailableFromAsync check
The core part of the check runs as follows
 1. Are we in an async context
 2. Does the decl we're calling have the unavailableFromAsync attribute
 3. Emit a diagnostic

There are a couple challenges that muddy the implementation. First,
single-expression closures are typechecked differently than
multi-expression closures. The single-expression closure is never added
to the closure stack. We have to record it separately upon entry to
verify separately. This is necessary for `_ = { foo() }()` where `foo`
is unavailable from async, and the surrounding context is async.

The second challenge is regarding when things get typechecked. A type
must be assigned to AbstractClosureExprs to determine whether they are
an async context or not. Unfortunately, availability checking runs
before types are fully assigned in some cases. This specifically happens
when working with result builders in specific conditions. I haven't been
able to figure out how to reduce the issue further.
2021-11-30 14:20:21 -08:00
Erik Eckstein
8229b374b1 Performance annotations: add attributes @_noLocks and @_noAllocation 2021-10-28 18:43:14 +02:00
Michael Gottesman
a589b4a128 [moveOnly] Add an @_noImplicitCopy decl attribute and allow it to be only attached to local lets.
Some notes:

1. This is not actually wired up to any part of codegen. Instead, this PR just
has the code necessary to parse the attribute and to ensure that we use it only
on local lets. The rest will come in subsequent commits.

2. I am allowing for the attribute to be attached to generic things in Sema
since we do not have enough information in the TypeChecker to distinguish in
between structs with a type parameter but that have all non-generic stored vars
from one with generic stored vars. We can only support the later with opaque
values but the former we can support without opaque values (and is one of the
use cases we are interested in).

rdar://83957088
2021-10-26 13:00:54 -07:00
mikun
4c612209d5 Fix typo 2021-10-18 11:37:31 +08:00
Becca Royal-Gordon
354f3470a0 Add @_nonSendable decl attribute
This attribute creates an unavailable extension with a `Sendable` conformance so that the type is explicity marked as not being `Sendable`.

We also fully suppress diagnostics about unavailable Sendable conformances in Swift 5 mode code. (This is not fully developed yet—it should return to being a warning in concurrent contexts.)

The behavior when a @_nonSendable and a Sendable conformance are both on the same type is also not right yet.
2021-10-14 12:14:46 -07:00
Doug Gregor
62b2054aa1 Remove @_distributedActorIndependent attribute entirely.
All its uses have been subsumed into `nonisolated`.
2021-10-01 23:08:22 -07:00
Hans Harck Tønning
53e8311513 Fixed a typo in UnderscoredAttributes.md
Fixed an accidental past tense in the Underscored Attributes reference guide; “inherited” => “inherit”.
2021-08-05 00:18:38 +02:00
Varun Gandhi
8e23a7ba30 [docs] Fix broken link to OptimizerEffects doc. 2021-08-04 10:45:02 -07:00
Varun Gandhi
d66562c4cb Merge pull request #38729 from varungandhi-apple/vg-tweak-docs
[docs] Make some corrections and additions to UnderscoredAttributes.md
2021-08-04 03:34:21 -07:00
Varun Gandhi
585ba571e0 [docs] Minor cleanup and consistency fixes in UnderscoredAttributes.md. 2021-08-03 12:56:33 -07:00
Varun Gandhi
297bc92cf9 [docs] Add documentation for _assemblyVision. 2021-08-03 12:56:33 -07:00
YOCKOW
be35884a29 [docs] UnderscoredAttributes.md: Prettify code in @_hasStorage. 2021-08-03 15:36:29 +09:00
Varun Gandhi
f42bde346b [docs] Add documentation for underscored attributes. (#37854)
Fixes rdar://65258964.
2021-08-02 18:20:05 -07:00