Commit Graph

2724 Commits

Author SHA1 Message Date
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
Nate Chandler
158c782960 [AST] Promote isNoImplicitCopy to Decl.
Move the predicate up from ParamDecl to Decl and use it everywhere in
place of hasAttribute<NoImplicitCopyAttr>.
2022-09-02 16:12:17 -07:00
Pavel Yaskevich
d341c4128c [AST] Make it possible to access type wrapper property (storage)
This is important because we need to force existance of the
underlying storage at the right moment.
2022-08-26 12:25:22 -07:00
Pavel Yaskevich
b3ed4d32ff [AST] Make it possible to access type wrapper storage of a var
This is important because we need to force existance of the
underlying storage at the right moment.
2022-08-26 12:25:22 -07:00
Pavel Yaskevich
39f5b69bce [TypeChecker] Synthesize initializer for a type wrapped declaration
Synthesize an `init` declaration which is going to initialize
type wrapper instance property `$_storage` via user provided
values for all stored properties.
2022-08-26 12:25:22 -07:00
Pavel Yaskevich
3dc441b3d3 [TypeChecker] Synthesize getters for stored properties of a type wrapped type
A getter routes accesses through a subscript of `$_storage` variable
injected into a wrapped type.
2022-08-26 12:25:22 -07:00
Pavel Yaskevich
69d80dc738 [AST] Add a way to check whether type has a type wrapper 2022-08-26 12:25:22 -07: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
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
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
4021082a55 [wip][cxx-interop] Support for custom reference counting operations. 2022-07-21 10:25:57 -04:00
Pavel Yaskevich
436b75b272 Merge pull request #59951 from xedin/se-360-support-unavailable
[TypeChecker] SE-360: Add support for `if #unavailable`
2022-07-20 19:14:25 -07:00
Pavel Yaskevich
225341e3d2 [Decl] Start storing and serializing "unavailability" bit per condition 2022-07-20 13:26:43 -07:00