Commit Graph

3461 Commits

Author SHA1 Message Date
Doug Gregor
237ff4cc29 Merge pull request #60985 from DougGregor/simplify-getAsyncAlternative
Simplify get async alternative
2022-09-07 17:50:20 -07:00
Doug Gregor
553537d326 Revert "[NFC] Add isKnownObjC param to RenamedDeclRequest"
This reverts commit 102f9a30c2.
2022-09-07 14:09:50 -07:00
Slava Pestov
7bf6803a61 Merge pull request #60923 from slavapestov/pack-expansion-type-repr
Introduce PackExpansionTypeRepr
2022-09-07 16:09:29 -04:00
Slava Pestov
79ed990728 AST: Replace TupleTypeRepr's ellipsis with PackExpansionTypeRepr 2022-09-07 12:35:54 -04:00
Alex Hoppen
442cf9bd4e [Sema] Add custom functions to ActorIsolationChecker to determine expr type and closure actor isolation
When we get rid of `LeaveClosureBodiesUnchecked` we no longer save closure types to the AST and thus also don’t save their actor isolation to the AST. Hence, we need to extract types and actor isolations of parent closures from the constraint system solution instead of the AST. This prepares `ActorIsolationChecker` to take custom functions to determine the type of an expression or the actor isolation of a closure.
2022-09-07 11:12:23 +02:00
Alex Hoppen
ec73a3a721 [AST] Move conversion of ClosureActorIsolation to ActorIsolation to its own function
Just a little bit of cleanup because this logic is really quite general and doesn't need to live in `getActorIsolationOfContext`.
2022-09-07 11:12:09 +02:00
swift-ci
6ce4bea5d1 Merge pull request #60688 from theblixguy/defer-isolation-closures
[Concurrency] Handle actor isolation for defers in closures
2022-08-31 19:21:13 -07:00
Pavel Yaskevich
e22fc3e34c Merge pull request #60345 from xedin/type-wrappers
[TypeChecker] Type wrappers (experimental feature)
2022-08-29 12:06:27 -07:00
Doug Gregor
0db7246c59 Merge pull request #60799 from DougGregor/generalize-actor-isolation 2022-08-26 13:03:00 -07:00
Pavel Yaskevich
bf2519aed9 [Sema] Allow implicit parameter decls to have property wrapper attributes 2022-08-26 12:25:22 -07:00
Doug Gregor
141ffc2b8d Model isolated parameters in ActorIsolation.
A function can be actor instance-isolated to one of its parameters.
Make sure that this is reflected in ActorIsolation, so such a function
doesn't get a different actor isolation.
2022-08-23 23:19:46 -07:00
Slava Pestov
5c32f2136e AST: Introduce RequirementKind::SameCount 2022-08-23 11:12:00 -04:00
Suyash Srijan
dd668d357c [Concurrency] Handle actor isolation for defers in closures 2022-08-22 14:11:25 +01:00
Allan Shortlidge
40eb1422bb IRGen/SIL: Fix IR linkage computation for inlined function references from modules imported @_weakLinked.
Include the parent `ModuleDecl` when serializing a `SILFunction` so that it is available on deserialized functions even though the full `DeclContext` is not present. With the parent module always available we can reliably compute whether the `SILFunction` comes from a module that was imported `@_weakLinked`.

Serialize the `DeclContext` member of `SILFunction` so that it can be used to look up the module that a function belongs to in order to compute weak import status.

Resolves rdar://98521248
2022-08-19 09:56:45 -07:00
Allan Shortlidge
f71a3232cf IRGen: Use extern_weak linkage for Clang symbols from @_weakLinked imported modules.
rdar://96098097
2022-08-11 11:02:57 -07:00
Allan Shortlidge
bc5f13cb6b AST: Accept @_weakLinked on import decls to force weak linkage of symbols from a module.
The effect of declaring an import `@_weakLinked` is to treat every declaration from the module as if it were declared with `@_weakLinked`. This is useful in environments where entire modules may not be present at runtime. Although it is already possible to instruct the linker to weakly link an entire dylib, a Swift attribute provides a way to declare intent in source code and also opens the door to diagnostics and other compiler behaviors that depend on knowing that all the module's symbols will be weakly linked.

rdar://96098097
2022-08-11 11:02:57 -07:00
Slava Pestov
87871d7347 AST: Rename getOpenedArchetypeSignature() to getOpenedExistentialSignature() 2022-08-10 23:44:36 -04:00
Slava Pestov
9d96ed940f AST: Rename 'canonical wrt. generic signature' to 'reduced'
We had two notions of canonical types, one is the structural property
where it doesn't contain sugared types, the other one where it does
not contain reducible type parameters with respect to a generic
signature.

Rename the second one to a 'reduced type'.
2022-08-09 12:46:31 -04:00
Slava Pestov
30c99b573a AST: Remove ExtensionDecl::alreadyBoundToNominal() 2022-08-05 12:45:00 -04:00
Pavel Yaskevich
5ee5a22cf1 [TypeChecker] NFC: Add a dedicated method to get outermost attached wrapper
The outermost wrapper is the one at index `0` in the wrapper list
but it's easy for humans to make a reverse assumption since outermost
is the back of the list. Let's add a dedicated method to reduce error
probability of the property wrapper APIs.
2022-08-04 17:30:02 -07:00
Hamish Knight
6e51841d14 [AST] Enforce that composeTuple drops parameter flags
Callers may either assert that the parameter flags
are empty, or ask for them to be dropped.
2022-08-02 13:56:31 +01:00
Allan Shortlidge
34012dbc68 Frontend: Rename -enable-ad-hoc-availability to -weak-link-at-target.
I am separating the concern of weakly linking symbols that are introduced at the deployment target from the concern of type checking this new type of potential unavailability.

Resolves rdar://97925900
2022-08-01 11:57:06 -07:00
Zoe Carver
bd003bcd7f Merge pull request #59509 from zoecarver/frt-with-ref-counting
[cxx-interop] Add support for reference counting operations on foreign reference types.
2022-07-23 20:51:39 -07:00
Michael Gottesman
afd8accb75 [move-only] Add a move only request to lookup if a ValueDecl is a "move only type".
I also created a SILType::isMoveOnly() helper that returns true if a type is
a move only wrapped type or a first class move only type. The verifier check
that move only types aren't copied in canonical SIL was rewired to use that as well.
2022-07-21 15:33:17 -07:00
zoecarver
13b0a5bc37 [nfc] Clang format changes. 2022-07-21 17:34:36 -04:00
zoecarver
74d76e2888 [cxx-interop] Add diagnostics and validation for retain/release function; require all foreign reference types to provide retain release functions or be immortal. 2022-07-21 12:25:21 -04:00
zoecarver
c9f54e1417 [nfc] Rename CxxCustom -> Custom and fix comments based on review feedback. 2022-07-21 10:25:57 -04:00
zoecarver
4021082a55 [wip][cxx-interop] Support for custom reference counting operations. 2022-07-21 10:25:57 -04:00
Pavel Yaskevich
225341e3d2 [Decl] Start storing and serializing "unavailability" bit per condition 2022-07-20 13:26:43 -07:00
Anton Korobeynikov
6e2c4faa34 [AutoDiff] Lookup for custom derivatives in non-primary source files (#58965)
* Lookup for custom derivatives in non-primary source files after typecheck is finished for the primary source.

This registers all custom derivatives before autodiff transformations and makes them available to them.

Fully resolves #55170
2022-07-18 11:52:02 -07:00
Konrad `ktoso` Malawski
728c007fb9 [Distributed] Implement witnesses for sync or non-throw dist reqs
[Distributed] generic and inner test; without one edge case

[Distributed] fix distributed_thunk test; unsure about those extra hops, could remove later

[Distributed] Remove type pretending in getSILFunctionType; it is not needed

It seems our constant replacement in the earlier phases is enough, and
we don't need this trick at all.

[Distributed] Use thunk when calling cross-actor on DA protocols
2022-07-04 19:02:11 +09:00
swift-ci
9aa2de4137 Merge pull request #41083 from kavon/inconvenienced-actors
[SE-327] Remove need for `convenience` for delegating initializers of an actor.
2022-06-30 14:56:32 -07:00
Konrad `ktoso` Malawski
ef525424f6 Merge pull request #59700 from xedin/distributed-computed-properties-via-accessor-thunk
[Distributed] Implement distributed computed properties via special accessor
2022-06-30 16:04:36 +09:00
Pavel Yaskevich
8d9962e605 [Distributed] Allow requesting distributed thunks on AbstractStorageDecl
One step towards future distributed subscripts.
2022-06-29 14:49:10 -07:00
Pavel Yaskevich
e8987b4c3e [Distributed] Add a new access strategy - DispatchToDistributedThunk
This strategy is used to dispatch accesses to 'distributed' computed
property to distributed thunk accessor instead of a regular getter
when access happen outside actor isolation context.
2022-06-29 14:49:10 -07:00
Pavel Yaskevich
fce3b856e3 [AST] Add new member access semantics - DistributedThunk
`DistributedThunk` is to be used while accessing 'distributed'
computed property outside of its actor context.
2022-06-29 14:49:10 -07:00
Pavel Yaskevich
5bdf94f346 [Distributed] Remove commented out code and print statements 2022-06-29 14:49:10 -07:00
Konrad `ktoso` Malawski
febfef97d4 [Distributed] Skeleton implementation of distributed computed properties 2022-06-29 14:49:04 -07:00
Allan Shortlidge
2515f7a58d Frontend: Introduce the -enable-experimental-ad-hoc-availability flag.
When developing a module for an OS or SDK, one may use declarations from other modules that were recently introduced in the in-development OS. Those declarations will be annotated as available at the deployment target of the client module and yet the symbols for that declaration are not available in all development builds of that OS. If the module strongly links those symbols, it will crash on older development builds of the OS. The `-enable-experimental-ad-hoc-availability` flag is designed to give developers the option of weakly linking all symbols in other modules that were introduced at the deployment target.

This change introduces the basic change in linking behavior but does not address typechecking. Use of the declarations that are made unavailable in this mode will need to be diagnosed and developers will need a way to detect the unavailability at runtime before use.

Resolves rdar://96011550
2022-06-29 11:44:07 -07:00
Pavel Yaskevich
add41afc47 [AST] Teach computeNominalType about nested ObjC protocols
Objective-C protocols unlike their Swift counterparts could be
nested in other types, so `computeNominalType` has to fetch a
parent for such protocols (if any) just like importer does.

Resolves: rdar://95084142
2022-06-28 12:06:26 -07:00
Kavon Farvardin
25b69d1e6e make sure all actor kinds, including distributed, are "semantically final" 2022-06-27 15:45:52 -07:00
Konrad `ktoso` Malawski
e78a7cbacb [Decl] remove not used and bad-idea isIsolated function 2022-06-22 15:36:43 +09:00
Holly Borla
429488f6c9 [Sema] Use ExistentialType for Any and AnyObject. 2022-06-17 18:29:15 -07:00
Konrad `ktoso` Malawski
0caf03d63f [Distributed] adjust test to pass with less accurate diagnostics; while we work on getting them back 2022-06-17 12:35:54 -07:00
Pavel Yaskevich
b963c6d20f [Distributed] Remove commented out code and print statements 2022-06-17 12:12:16 -07:00
Konrad `ktoso` Malawski
5a5b7c007c towards distributed getters 2022-06-17 12:12:16 -07:00
Konrad `ktoso` Malawski
079bbcf517 wip 2022-06-17 12:12:16 -07:00
Becca Royal-Gordon
102f9a30c2 [NFC] Add isKnownObjC param to RenamedDeclRequest
This will be used to break cycles in a future commit.
2022-06-16 14:06:47 -07:00
Doug Gregor
774a94f69d Make sure we can dig out the (distributed) actor from an archetype.
Fixes #59356 / rdar://94976378.
2022-06-14 10:57:29 -07:00
Konrad `ktoso` Malawski
bd052eedd7 improve FIXME to link to issue 2022-06-10 13:41:37 +09:00