Commit Graph

74 Commits

Author SHA1 Message Date
Doug Gregor
2f2c194272 Adopt 'nonisolated' in many tests, make sure its a modifier 2021-03-07 11:37:57 -08:00
Doug Gregor
f56ba59605 Add 'nonisolated' modifier as the preferred spelling for @actorIndependent 2021-03-07 10:57:35 -08:00
Kavon Farvardin
0c675c74cf Improve error messages for implicitly-async in sync contexts
when an expression that would be validly considered implicitly-async appears
within a sync context, we try to be a bit more specific about the problem
being that it's a sync context.
2021-03-06 10:26:44 -08:00
Doug Gregor
2b6bda269e Update diagnostics in some tests 2021-03-05 00:24:38 -08:00
Doug Gregor
a7c6a1afad Eliminate circular references while checking property wrapper isolation 2021-03-04 22:49:57 -08:00
Doug Gregor
8a4cb8bafd Support actor isolation for property wrappers
Property wrappers can provide global actor isolation based on the
property wrapper type itself (which affects the backing property),
`wrappedValue` (which affects the wrapped property), and
`projectedValue` (which affects the $ property). This allows us to
express, e.g., property wrappers that require accesses to occur on a
particular global actor.
2021-03-04 22:49:57 -08:00
Doug Gregor
1de83ac0da Enforce safe access to unsafe global actor declarations only from "new" code.
Allow references to unsafe global actor-isolated declarations only from
existing code that has not adopted concurrency features (such as
async, @concurrent closures, etc.). This allows declarations that
should be isolated to a global actor to be annotated as such without
breaking existing code (as if isolation was unspecified), while code
that does adopt concurrency will treat the declaration as being part
of that global actor.
2021-03-03 17:59:01 -08:00
Doug Gregor
451e6cc1f5 [Concurrency] Add support for @GlobalActor(unsafe).
Allow us to tag declarations that are meant to be in a global actor, but
for which we don't yet want to enforce everything. This will be used for
better staging-in of global actor annotations, but for now it's a fancy
way to document @actorIndependent(unsafe).

Stages in the syntax for rdar://74241687 without really implementing it.
2021-02-25 22:41:32 -08:00
Doug Gregor
a864c5575f Update remaining test cases 2021-02-24 13:45:11 -08:00
Kavon Farvardin
9342540661 add fix-it to note for "add 'async' to function"
resolves rdar://72313654
2021-02-11 14:44:49 -08:00
Evan Wilde
8b80331c3d Updating tests to use actor
This patch updates the `actor class` spelling to `actor` in almost all
of the tests. There are places where I verify that we sanely handle
`actor` as an attribute though. These include:

 - test/decl/class/actor/basic.swift
 - test/decl/protocol/special/Actor.swift
 - test/SourceKit/CursorInfo/cursor_info_concurrency.swift
 - test/attr/attr_objc_async.swift
 - test/ModuleInterface/actor_protocol.swift
2021-02-10 08:09:13 -08:00
Kavon Farvardin
0d99a30269 Merge pull request #35012 from kavon/concurrency-lib-upgrades
[concurrency] partially implement @MainActor + convenience method for UnsafeThrowingContinuation
2021-01-07 09:49:01 -08:00
Kavon Farvardin
a2c57d13c3 [concurrency] initial declaration of MainActor
Implementation is left as a TODO for now.

Resolves rdar://72161578
Partially resolves rdar://72105129
2021-01-06 15:01:22 -08:00
Doug Gregor
ec2aacefca [Concurrency] Fix actor-isolation override checking with @asyncHandler.
`@asyncHandler` methods can override with a completely different actor
isolation because they will hop to the appropriate actor themselves.
Therefore, allow differing actor isolation when an `@asyncHandler`
method overrides another method, and don't propagate the actor
isolation from the overridden method to the overriding `@asyncHandler`
method.
2021-01-05 17:38:25 -08:00
Doug Gregor
8b9cbe2411 [Concurrency] Always infer actor isolation from overridden declaration.
Infer actor isolation from the overridden declaration unless some other
isolation attribute was explicitly specified directly on that
declaration. This allows type- and extension-level annotations with
a global actor to not break overrides.
2021-01-05 16:59:51 -08:00
Kavon Farvardin
e8dcc979a0 fix-it regression coverage for notes suggesting 'async', '@asyncHandler' and '@GlobalActorType'
Currently, we don't have a fix-it to insert 'async', so I've marked those places
as not expecting a fix-it, until someone goes and implements that (rdar://72313654)
2020-12-14 15:21:27 -08:00
Kavon Farvardin
e23f0abbe8 [concurrency] patch hole in typechecking ordinary functions for global actor references
Non-actor isolated synchronous functions were previously
allowed to call & reference global-actor isolated declarations.
This patch puts a stop to that.

Resolves rdar://71548470
2020-12-14 12:23:59 -08:00
Kavon Farvardin
eb665f6d35 improve and fix diagnostic for implicitly async calls 2020-11-19 17:08:18 -08:00
Kavon Farvardin
9cba85573f update existing tests for new implicitly-async calls. 2020-11-19 17:08:18 -08:00
John McCall
a8464dcaf1 Implicitly import _Concurrency under -enable-experimental-concurrency 2020-10-22 00:53:15 -04:00
Doug Gregor
a5b15ed630 [Concurrency] Substitute into superclass global actors when inheriting them. 2020-10-13 22:40:51 -07:00
Doug Gregor
11cf3ceffe [Concurrency] Eliminate actor isolation checking for subclasses.
Subclasses inherit the global actor from their superclass by default,
but it's okay to change it---it's just a default that can be
overridden on a per-member basis anyway.
2020-10-13 22:37:24 -07:00
Doug Gregor
18fd4be17a [Concurrency] Check actor isolation consistency for overrides & subclasses.
Both overriding declarations and subclasses must have the actor
isolation as their overridden declarations or superclasses,
respectively. Enforce this, ensuring that we're also doing the
appropriate substitutions.
2020-10-13 21:41:59 -07:00
Doug Gregor
f089ba9464 [Concurrency] Propagation of actor constraints.
Implement propagation rules for global actor constraints, which can come from:

* Enclosing extension or type
* Superclass of a class
* Overridden declaration
* Requirement witnessed by a declaration
* Storage declaration for an accessor
2020-10-13 15:17:13 -07:00