Commit Graph

465 Commits

Author SHA1 Message Date
Alex Hoppen
52f062d409 [Cleanup] Remove AttributeKinds.py
I forgot to remove this file in https://github.com/apple/swift/pull/67666
2023-08-17 16:49:29 -07:00
Pavel Yaskevich
b21e8426a0 [AST] NFC: Remove @runtimeMetadata related code 2023-08-15 12:16:40 -07:00
Alex Hoppen
ef8e4ac0f3 [AST] Remove gyb_syntax_support
We are no longer using these Python files to generate anything in SwiftSyntax. We can just remove them and instead commit the generated `.def` files.
2023-08-01 17:20:14 -07:00
Robert Widmann
a178cf9a00 Cede Ownership of Swift Attributes to swift-syntax
Replace Attr.def with a gyb file that reads from swift-syntax
to automatically generate the attribute nodes.

For now, only the Swift attributes have been migrated. SIL attributes
can be defined manually in Attr.def.gyb. To add new Swift attributes,
a paired pull request to swift-syntax is now necessary.
2022-09-13 17:30:29 -07:00
Pavel Yaskevich
3f5dec53c0 Merge pull request #61028 from xedin/type-wrapper-ignore-attr
[AST/TypeChecker] TypeWrappers: Add @typeWrapperIgnored attribute
2022-09-13 09:23:02 -07:00
nate-chandler
6075af2652 Merge pull request #61048 from nate-chandler/no_eager_move_attr
Renamed _noEagerMove attribute.
2022-09-12 13:14:32 -07:00
Nate Chandler
5642a46378 Renamed _noEagerMove attribute.
Avoid introducing extra terminology via an underscored attribute.

rdar://99723104
2022-09-12 08:21:18 -07:00
Pavel Yaskevich
116dea2f6d [AST/TypeChecker] TypeWrappers: Add @typeWrapperIgnored attribute
`@typeWrapperIgnored` attribute could be used on stored properties
of a type wrapped type to exclude them from type wrapper transform.
2022-09-09 23:52:35 -07:00
Slava Pestov
217c4a5ef3 Sema: Remove the older '@tuple (Int)' syntax 2022-09-10 00:26:43 -04:00
nate-chandler
2efc0f6857 Merge pull request #60940 from nate-chandler/eager_move_self
Self parameters can be @_noImplicitCopy or @_eagerMove.
2022-09-07 06:12:53 -07:00
QuietMisdreavus
f674b473ec introduce a @_documentation(...) attribute to influence SymbolGraphGen (#60242)
* add @_documentation(...) attribute to influence SymbolGraphGen

rdar://79049241
2022-09-06 14:12:42 -06:00
Nate Chandler
cacac0bd83 [SILGen] Allow annotating self @_noImplicitCopy.
Allow @_noImplicitCopy to be applied to methods.  Applying it there
means that the self argument will have the attribute.
2022-09-02 17:32:48 -07:00
Nate Chandler
9dbdfa8e3f [SILGen] Allow annotating self @_eagerMove.
Allow @_eagerMove (and @_lexical) to be applied to methods.  Applying
it there means that the self argument will have the attribute.
2022-09-02 16:13:08 -07:00
Alexis Laferrière
aaaef3411e [Sema] Intro @_spiOnly attribute and import filter
Introduce the attribute and basic import filter logic.
2022-09-01 15:16:44 -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
Alex Lorenz
7bf7642d51 [interop][SwiftToCxx] support @_expose attribute on initializers 2022-08-29 07:41:49 -07:00
Pavel Yaskevich
38765fbd9a [AST] Add a new @typeWrapper attribute 2022-08-26 12:25:22 -07:00
Alex Lorenz
8de79390be [interop][SwiftToCxx] add @_expose(Cxx) attribute support
This attribute instructs the compiler that this declaration should be included in the generated C++ bindings
2022-08-24 10:14:07 -07:00
Slava Pestov
7a335d6c66 AST: Introduce @tuple (T) syntax for one-element tuples in SIL mode 2022-08-23 11:12:00 -04:00
Nate Chandler
b3ae13ddbe [Sema] Added _eagerMove and _lexical attributes.
The new attributes affect how the lifetimes of values may be shortened.
2022-08-21 21:44:53 -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
Artem Chikin
4e2c1d16f6 Add '@_alwaysEmitConformanceMetadata' protocol attribute
This attribute will, in the near future, be used to inform IRGen that a nominal type that conforms to such protocol must have its type metadata always emitted into the binary, regardless of whether it is used/public.
2022-08-04 14:19:33 -07:00
Michael Gottesman
d73c538bb8 [move-only] Add a moveOnly attribute that can be added to nominal types.
Currently it doesn't have any effect.
2022-07-21 15:33:01 -07:00
Konrad `ktoso` Malawski
febfef97d4 [Distributed] Skeleton implementation of distributed computed properties 2022-06-29 14:49:04 -07:00
Konrad `ktoso` Malawski
6a2778645f Revert "Merge pull request #59481 from xedin/distributed-computed-properties"
This reverts commit 8125a85a8f, reversing
changes made to 728971c5b7.
2022-06-25 08:49:00 +09:00
Pavel Yaskevich
fa2e64c1fd [Distributed] Sema: Add a new distributed-thunk attribute
The attribute comes handy during solution application to
determine whether the call is using a distributed thunk.
2022-06-17 12:35:54 -07:00
Konrad `ktoso` Malawski
079bbcf517 wip 2022-06-17 12:12:16 -07:00
Michael Gottesman
464d7ecac2 [ast] Add a @moveOnly type attribute only available at the SIL level.
It currently is just removed when we type check types, so it doesn't do
anything. Eventually this is going to be the way at the SIL level one can
convert an AST type into its move only equivalent.
2022-06-03 11:27:16 -07:00
Rintaro Ishizaki
9f3bc0e85b [CodeCompletion] _compilerInitialized and _local are UserInaccessible
These declaration modifiers are not meant to be used from user source
code. Mark them 'UserInaccessible' so code completion don't show them.

rdar://92970201
2022-05-09 15:30:59 -07:00
Joe Groff
1e2bda9ea0 Extensions to SILBoxType to represent captures.
- Add a `[reflection]` bit to `alloc_box` instructions, to indicate that a box
  should be allocated with reflection metadata attached.
- Add a `@captures_generics` attribute to SILLayouts, to indicate a type layout
  that captures the generic arguments it's substituted with, meaning it can
  recreate the generic environment without additional ABI-level arguments, like
  a generic partial application can.
2022-04-21 12:51:46 -07:00
Kavon Farvardin
d58bd274f0 Merge pull request #41740 from kavon/assign-actorSystem
[distributed] Require explicit assignment of `actorSystem`
2022-03-24 21:53:01 -07:00
Kavon Farvardin
13cbe0dd15 adding the @_compilerInitialized attribute
This attribute is designed for let-bound variables whose initializing
assignment is synthesized by the compiler. This assignment is
expected to happen at some point before DefiniteInitialization has
run, which is the pass that verifies whether the compiler truly
initialized the variable.

I generally expect that this will never be a user-facing feature, and
that the synthesized assignment happens in SILGen.
2022-03-24 16:18:49 -07:00
Doug Gregor
3cdf178c69 Eliminate DistributedOnly flag on attributes.
Distributed actors are enabled by default, so we don't need this flag
any more.
2022-03-24 15:59:59 -07:00
Konrad `ktoso` Malawski
5ab8e0834d [Distributed] Reimplement distributed call thunks completely in AST (#41616)
* [Distributed] dist actor always has default executor (currently)

* [Distributed] extra test for missing makeEncoder

* [DistributedDecl] Add DistributedActorSystem to known SDK types

* [DistributedActor] ok progress on getting the system via witness

* [Distributed] allow hop-to `let any: any X` where X is DistActor

* [Distributed] AST: Add an accessor to determine whether type is distributed actor

- Classes have specialized method on their declarations
- Archetypes and existentials check their conformances for
  presence of `DistributedActor` protocol.

* [Distributed] AST: Account for distributed members declared in class extensions

`getConcreteReplacementForProtocolActorSystemType` should use `getSelfClassDecl`
otherwise it wouldn't be able to find actor if the member is declared in an extension.

* [Distributed] fix ad-hoc requirement checks for 'mutating'

[PreChecker] LookupDC might be null, so account for that

* [Distributed] Completed AST synthesis for dist thunk

* [Distributed][ASTDumper] print pretty distributed in right color in AST dumps

* wip on making the local/remote calls

* using the _local to mark the localCall as known local

* [Distributed] fix passing Never when not throwing

* fix lifetime of mangled string

* [Distributed] Implement recordGenericSubstitution

* [Distributed] Dont add .

* [Distributed] dont emit thunk when func broken

* [Distributed] fix tests; cleanups

* [Distributed] cleanup, move is... funcs to DistributedDecl

* [Distributed] Remove SILGen for distributed thunks, it is in Sema now!

* [Distributed]  no need to check stored props in protocols

* remote not used flag

* fix mangling test

* [Distributed] Synthesis: Don't re-use AST nodes for `decodeArgument` references

* [Distributed] Synthesis: Make sure that each thunk parameter has an internal name

* [Distributed/Synthesis] NFC: Add a comment regarding empty internal parameter names

* [Distributed] NFC: Adjust distributed thunk manglings in the accessor section test-cases

* cleanup

* [Distributed] NFC: Adjust distributed thunk manglings in the accessor thunk test-cases

* review follow ups

* xfail some linux tests for now so we can land the AST thunk

* Update distributed_actor_remote_functions.swift

Co-authored-by: Pavel Yaskevich <xedin@apache.org>
2022-03-10 23:58:23 +09:00
Hamish Knight
a2cfbda850 Revert "Cleaning up _runAsyncMain a bit" 2022-03-05 13:14:36 +00:00
Evan Wilde
1ab41bf955 Merge pull request #40661 from etcwilde/ewilde/concurrency/cleanup-run-async-main
Cleaning up _runAsyncMain a bit
2022-03-04 21:25:18 -08:00
Slava Pestov
7ad9d891fe Merge pull request #41640 from slavapestov/primary-associated-type-syntax
New syntax for declaring primary associated types
2022-03-03 21:59:46 -05:00
Slava Pestov
a013cd2076 AST: Replace PrimaryAssociatedTypeAttr with AssociatedTypeDecl::isPrimary() flag 2022-03-03 10:15:02 -05:00
Rintaro Ishizaki
912285b0e4 Merge pull request #41606 from rintaro/sourcekit-ifacegen-rdar79927502
[SourceKit] Print custom attributes in interface-gen requests
2022-03-02 23:31:09 -08:00
Rintaro Ishizaki
b6119018d7 [SourceKit] Print custom attributes in interface-gen requests
Custom attributes were not printed because they are marked
'UserInaccesible'.

* Make CustomAttr 'RejectByParser' instead of 'UserInaccessible'
* Remove special treatment for Result Builder attributes
* Load implicit modules in module/header interface gen requests

rdar://79927502
2022-03-02 11:05:26 -08:00
Allan Shortlidge
e39c55023f AST: Add support for @_backDeploy on computed properties, subscripts, and accessors. 2022-03-01 13:29:09 -08:00
Evan Wilde
b6414b383b Merge branch 'main' into ewilde/concurrency/cleanup-run-async-main 2022-02-17 16:08:17 -08:00
John McCall
b3b6701a50 Implement @_unsafeInheritExecutor.
SE-0338 changed the execution of non-actor async functions
so that they always hop to the generic executor, but some
functions need a way to suppress this so that they inherit
the caller's executor.

The right way to implement this is to have the caller pass
down the target executor in some reliable way and then
switch to it in all the appropriate places in the caller.
We might reasonably be able to build this on top of isolated
parameters, using some sort of default argument, or we might
need a wholly novel mechanism.

But those things are all ABI-breaking absent some sort of
guarantee about switching that we probably don't want to make,
and unfortunately we have functions in the library which we
need to export that need to inherit executors.  So in the
short term, we need some unsafe way of getting back to the
previous behavior.
2022-02-14 20:46:03 -05:00
swift-ci
4e3d4d2145 Merge pull request #41233 from ktoso/wip-distributed-get-only-properties 2022-02-09 00:58:57 -08:00
Allan Shortlidge
b860e762b2 AST: Introduce the @_backDeploy function attribute:
- Parse the attribute and diagnose parsing issues
- Serialize the attribute
2022-02-08 10:11:04 -08:00
Konrad `ktoso` Malawski
42108f33e5 [Distributed] allow get only distributed computed properties 2022-02-08 23:06:29 +09:00
Doug Gregor
45e64e45ef Merge pull request #40680 from DougGregor/preconcurrency-attr 2022-01-27 16:48:11 -08:00
Doug Gregor
7149702d12 Rename @_predatesConcurrency to @preconcurrency.
Introduce the `@preconcurrency` attribute name for `@_predatesConcurrency`,
which has been the favored name in the pitch thread so far. Retain the
old name for now to help smooth migration.
2022-01-26 08:39:01 -08:00
Slava Pestov
ab2935a85e AST: Introduce @_primaryAssociatedType attribute 2022-01-26 00:11:38 -05:00
Erik Eckstein
beb2bd2a96 AST: support @_effects attribute with custom strings.
In addition to the predefined cases,  like "readnone", "readonly", etc. support providing a custom string, which will be parsed later.
Also, allow multiple effects attributes to be put onto a function.
2022-01-25 11:29:23 +01:00