Commit Graph

2738 Commits

Author SHA1 Message Date
Doug Gregor
787af41765 [Macros] Parse generic arguments in macro expansions. 2022-11-17 16:46:43 -08:00
Angela Laar
3d9ce2748a Merge pull request #62161 from angela-laar/some-elision-circular-ref
[AST] Fix circular reference with implicit some
2022-11-17 15:53:52 -08:00
Angela Laar
bde6a465af [AST] Fix circular reference with implicit some
getPotentiallyOpaqueGenericParams has a redundant call to check if
declarations contain any opaque type representations. We don't need
to check this here. Instead we can simply collect the result type
representaions without the additional checks.
2022-11-17 11:53:50 -08:00
Allan Shortlidge
abdc4d9112 SILGen: Use has_symbol instruction in SILGen. 2022-11-16 16:07:29 -08:00
Robert Widmann
4c162b2aeb Delete libSyntax 2022-11-16 14:52:28 -08:00
Pavel Yaskevich
e762d20568 Merge pull request #61982 from xedin/type-wrappers-on-protocols
[Sema] TypeWrappers: Allow type wrappers on protocols and inference from them
2022-11-14 12:46:48 -08:00
Doug Gregor
5ab6b72604 [Macros] Turn Macro into a declaration node.
Although the declaration of macros doesn't appear in Swift source code
that uses macros, they still operate as declarations within the
language. Rework `Macro` as `MacroDecl`, a generic value declaration,
which appropriate models its place in the language.

The vast majority of this change is in extending all of the various
switches on declaration kinds to account for macros.
2022-11-13 12:21:29 -08:00
Allan Shortlidge
114ee28639 AST: Add a DescriptiveDeclKind for actors. 2022-11-08 19:17:09 -08:00
Slava Pestov
16a84fc382 AST: Rename ProtocolDecl::getExistentialType() to getDeclaredExistentialType() 2022-11-07 18:38:06 -05:00
Pavel Yaskevich
db4b6a5c0f [AST/Sema] TypeWrappers: Implement type wrappers on protocols
Adding a type wrapper attribute on a protocol does two things:

- Synthesizes `associatedtype $Storage` declaration with `internal` access
- Synthesizes `var $storage: <#Wrapper#><Self, Self.$Storage>` value requirement
2022-11-07 14:55:05 -08:00
Pavel Yaskevich
82f34b90c1 [AST] NameLookup: Add a request to gather protocol requirements 2022-11-04 11:11:41 -07:00
Slava Pestov
36b3f0ee12 AST: Remove AbstractTypeParamDecl 2022-11-01 19:13:46 -04:00
Slava Pestov
0e4ccb21ed AST: Remove various references to AbstractTypeParamDecl 2022-11-01 19:13:46 -04:00
Slava Pestov
ad06d27e88 AST: Remove AbstractTypeParamDecl::getSuperclass()/getConformingProtocols() 2022-11-01 19:13:46 -04:00
Alexis Laferrière
34779d46a9 Merge pull request #61789 from xymus/serial-rebuilt-bit
[Serialization] Write in the binary swiftmodule file whether it was rebuilt from a swiftinterface
2022-10-29 09:31:23 -07:00
Alexis Laferrière
2854c1b3cb [Serialization] Write in the swiftmodule if it's built from a swiftinterface
This information will allow us to distinguish swiftmodule built from
source vs swiftinterface.
2022-10-27 18:51:28 -07:00
Becca Royal-Gordon
881f1f90a8 Re-allow @objc final
Treating this as forbidden was incorrect; an `@objc final` method is simply one that isn’t a member implementation but does have an ObjC entry point.

Formalize and centralize the definition of what a member implementation is, tweak it so that it’s basically “non-final and internal or greater”, and permit `@objc final`. Also remove the inference of `final` on `let`s in @_objcImpl extensions.
2022-10-27 16:51:13 -07:00
Pavel Yaskevich
d8cfe03beb Merge pull request #61501 from xedin/type-wrappers-add-wrapped-type
[AST/Sema] TypeWrappers: Extend implementation to support wrapped type
2022-10-27 08:55:38 -07:00
Allan Shortlidge
0d37f52fe0 APIDigester: Break cycle between Frontend and APIDigester targets.
Also push a utility that was previously on `SILDeclRef` down to AST so that the SIL dependency can be removed entirely from APIDigester.
2022-10-26 20:30:36 -07:00
Pavel Yaskevich
2ae0cb802a [AST/Sema] TypeWrappers: Add a request skeleton to synthesize init(storageWrapper: <Wrapper>)
If there are no type wrapper ignored stored properties, the
compiler would synthesize a special public initializer that
allows to initialize a wrapped type by providing a fully
initialized wrapper instance.
2022-10-21 20:04:01 +01:00
swift-ci
1ebcd13975 Merge pull request #61662 from rxwei/macro-expansion-expr
[Macros] Parse MacroExpansionExpr and MacroExpansionDecl
2022-10-21 06:13:41 -07:00
Richard Wei
56e7cce809 [Macros] Parse MacroExpansionExpr and MacroExpansionDecl
Introduce `MacroExpansionExpr` and `MacroExpansionDecl` and plumb it through. Parse them in roughly the same way we parse `ObjectLiteralExpr`.

The syntax is gated under `-enable-experimental-feature Macros`.
2022-10-21 01:50:35 -07:00
Pavel Yaskevich
5c8c008c8e Merge pull request #61479 from xedin/type-wrappers-init-values-in-user-defined-inits
[SILGen] TypeWrappers:  Support default values in user-defined initializers
2022-10-21 08:48:35 +01:00
Becca Royal-Gordon
ecf0ee65b8 Cache @_objcImpl pointers and diagnose dupes 2022-10-18 17:21:56 -07:00
Becca Royal-Gordon
3a2f12a099 Allow stored properties in @_objcImpls
Stored properties are only allowed in the extension implementing the class's main interface, not its categories. This also means banning `@objc final`, which is unenforceable anyway when ObjC subclasses are allowed, and therefore allowing `@objc let` and `@objc static` properties to be overridden if they're declared in objcImplementations.
2022-10-18 17:21:56 -07:00
Becca Royal-Gordon
f2a0ab79c7 Add basic Sema support for @_objcImplementation
Does not validate members yet; nor does it emit different metadata.
2022-10-18 17:21:56 -07:00
Slava Pestov
a5453f1649 AST: Add new variant of swift::getParameterAt() which takes pack expansions into account 2022-10-16 21:37:25 -04:00
Hamish Knight
48ea933804 Parse an ellipsis T... for type parameter packs
In a generic parameter list, parse an ellipsis
to produce a type parameter pack. This replaces
the previous `@_typeSequence` attribute.
2022-10-14 15:40:12 +01:00
Hamish Knight
b645e63ce5 [AST] NFC: Refactor GenericTypeParamDecl construction
Add distinct overloads for the parser,
deserialization and code synthesis.
2022-10-14 15:40:12 +01:00
Allan Shortlidge
182cc8de37 SILGen: Implement if #_hasSymbol() conditions.
Emit a call to a helper function that determines whether the symbols associated with the declaration referenced in the `#_hasSymbol(...)` condition are non-null at runtime. An upcoming change will emit a definition for this function during IRGen.

Resolves rdar://100130015
2022-10-13 21:00:24 -07:00
Holly Borla
c4b946195e [AST] Replace the "type sequence" terminology with "parameter pack". 2022-10-10 16:28:13 -07:00
Pavel Yaskevich
cba7a78605 [AST] Make it possible to check if var decl is for _storage 2022-10-07 17:36:10 -07:00
Slava Pestov
92f1361b82 Merge pull request #61429 from LucianoPAlmeida/opaque-parameters-crash
[AST] Move generic parameter logic for accessor decl from parser to GenericParamListRequest
2022-10-07 16:52:24 -04:00
Luciano Almeida
a95f60e387 [AST] Refactor generic parameter list parse logic for AccessorDecl 2022-10-07 09:43:08 -03:00
Pavel Yaskevich
224708d93d [AST] TypeWrappers: Add request to retrieve type wrapper initializer 2022-09-29 20:50:37 -07:00
Pavel Yaskevich
92fbb3ebf3 [AST/Sema] TypeWrappers: Rename wrapped type memberwise initializer entry point 2022-09-29 20:50:37 -07:00
Pavel Yaskevich
1ee14f5424 [AST] Add a way to retrieve $Storage decl from a type wrapped type 2022-09-29 20:50:36 -07:00
Pavel Yaskevich
412915eadd [AST] TypeWrappers: A request to synthesize _storage variable for an initializer
User-defined initializer would populate `_storage` incrementally
so it could be passed to `<TypeWrapper>.init(memberwise:)` call
to initialize the type wrapper.
2022-09-29 20:50:36 -07:00
Angela Laar
ae2c6a18d8 [Sema] Resolve ident type to opaque result type
This is just more work to get type resolution to understand
how to derive an opaque type from an IdentTypeRepr during
OpaqueResultTypeRequest
2022-09-20 15:25:09 -07:00
Angela Laar
5f3191c74e [AST] Teach GenericParamList amd OpaqueReturnType Request to use plain protocols
Originally protocols prefixed with 'some' keyword are considered an opaue return
type representation. In order to understand plain protocols, the GenericParamList
Request must understand how to build a generic parameter list using alternative
type representations: identifier and composition.
2022-09-20 15:25:09 -07:00
Hamish Knight
20830cc2fb [Profiler] Avoid profiling unavailable decls
Such decls don't provide useful coverage info.

rdar://83253091
2022-09-19 10:06:36 +01:00
Allan Shortlidge
6b61e37364 SILGen: Function availability for linkage should use @_backDeploy OS version if present.
When computing the availability of a `SILFunction` for linkage the OS version specified in the `@_backDeploy` attribute should be preferred over the version in the `@available` attribute. This ensures that the corresponding symbol is weakly linked when deploying to older OSes than the back deploy "before" version.

Resolves rdar://99962885
2022-09-16 17:05:35 -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
Slava Pestov
c1b8690401 AST: Introduce special Builtin.TheTupleType singleton 2022-09-10 00:26:42 -04:00
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
79ed990728 AST: Replace TupleTypeRepr's ellipsis with PackExpansionTypeRepr 2022-09-07 12:35:54 -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
Nate Chandler
da2de4d01e [AST] Promote getLifetimeAnnotation.
Move it up to Decl in preparation for getting it from AbstractFuncDecls.
2022-09-02 16:12:55 -07:00