Commit Graph

8 Commits

Author SHA1 Message Date
Holly Borla
9c1f7e3ca5 [Concurrency] When expanding #isolation create a type-checked type
expr for global actors.

This eliminates a crash when type checking `#isolation` expansions
for global actors nested in other types, because the `TypeExpr`
does not properly represent the type repr for nested types. It's
simpler to provide the type directly instead of going through type
resolution.
2025-03-28 15:43:11 -07:00
Holly Borla
6f5a64c0ca [Concurrency] Don't crash if a #isolation default argument has a type
mismatch.

The actor isolation checker was setting the actor value for
`#isolation` when type checking the expression failed. Later on, the
isolation checker would crash when querying the type of the actor, e.g.
to check if it's a distributed actor. Instead, keep the actor value as
null if there's a type mismatch.
2024-08-31 21:46:32 -07:00
Holly Borla
26621b804c [Concurrency] Enable optional isolated parameters. 2024-02-16 16:28:45 -08:00
Holly Borla
ddf2fc44f4 [Concurrency] Allow #isolation to have a more specific contextual type. 2024-02-16 16:27:54 -08:00
Holly Borla
5cb418a2a7 Merge pull request #71511 from hborla/explicit-isolation-expansion
[Concurrency] Make `#isolation` macro expansions explicit.
2024-02-09 15:44:33 -08:00
Holly Borla
1875817bdd [Concurrency] Make #isolation macro expansions explicit.
Macro expansions are never considered implicit. They have
valid source locations in their macro expansion buffer, they
do not cause implicit 'self' capture diagnostics, etc. This
fixes an issue where existing code that iterates over an async
sequence in an escaping closure would diagnose a use of implicit
'self' via the '#isolation' argument to 'next()'.
2024-02-09 12:05:16 -08:00
Finagolfin
8e7a5c6e53 [Test] Make sure macros are enabled for the tests that use the new #isolation macro 2024-01-28 02:20:07 +05:30
Doug Gregor
255009dddb Implement #isolation macro to produce the isolation of the current context
Introduce a new expression macro that produces an value of type
`(any AnyActor)?` that describes the current actor isolation. This
isolation will be `nil` in non-isolated code, and refer to either the
actor instance of shared global actor in other cases.

This is currently behind the experimental feature flag
OptionalIsolatedParameters.
2024-01-16 14:25:51 -08:00