Commit Graph

2588 Commits

Author SHA1 Message Date
Hamish Knight
169c4cabd6 [test] Disable a couple of @_objcImplementation tests
rdar://101543397
rdar://101420862
2022-10-26 11:49:27 +01:00
Michael Gottesman
971d581b51 Merge pull request #61711 from gottesmm/pr-8e7407db044609579456f02173cda0dbd572217d
[move-only] Change type lowering to ensure we use {retain,release}_value instead of strong_{retain,release}
2022-10-25 09:25:35 -07:00
Hamish Knight
d310542f3c [test] Disable objc_implementation_objc_client.m
rdar://101497120
2022-10-25 14:31:46 +01:00
Michael Gottesman
285f03ee8c [move-only] Change type lowering to ensure that we use {retain,release}_value instead of strong_{retain,release} for move only enum/structs
This ensures that when we hit IRGen, if we have a type with trivial contents, we
emit nothing and if we have a type with non-trivial contents, we just emit
recursive retain/release as appropriate.

This is the last bug holding up the buffer view prototype from Guilliume.
2022-10-24 21:16:46 -07:00
Pavel Yaskevich
a82d8a5eff [TypeWrappers] NFC: Remove property key path printing
Some of the key paths are printed inconsistently across
different platforms.
2022-10-21 20:04:01 +01:00
Pavel Yaskevich
5eafcf66d7 [AST/Sema] TypeWrapper: Implement synthesis of init(storageWrapper:) initializer 2022-10-21 20:04:01 +01:00
Pavel Yaskevich
34fc834f6e [AST/Sema] TypeWrappers: Use special subscript to manage storage of classes
New subscript allows to pass wrapped self instance down to the
type wrapper and is declared as follows:

```
subscript<...>(wrappedSelf <name>: Wrapped, propertyKeyPath: ..., storageKeyPath: ...)
```

The type-checker would use it to synthesize getter/setter accessors for
managed storage if wrapped type is a class.
2022-10-21 20:04:01 +01:00
Pavel Yaskevich
358346c0d5 [AST/Sema] TypeWrappers: Add propertyKeyPath parameter to type wrapper subscripts
The compiler is going to synthesize `\.<property-name>` as an argument
to `propertyKeyPath:` parameter which points to the wrapped property.
2022-10-21 20:04:01 +01:00
Pavel Yaskevich
b769f9f2e4 [Sema] TypeWrappers: Adjust synthesized type wrapper init calls to pass the wrapped type 2022-10-21 20:04:01 +01:00
Pavel Yaskevich
0f48f5c152 [AST/Sema] TypeWrappers/NFC: Rename type wrapper init parameter to storage: 2022-10-21 20:04:00 +01: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
7f0791ed44 Temporarily disable test in simuilators for CI
This is failing in the iOS simulator, but *only* in Swift CI, not locally (even with the same tools). Disable the test ouside of macOS while we investigate the failure.
2022-10-18 17:21:56 -07:00
Becca Royal-Gordon
ad359fa753 Give @_objcImpl classes implicit deinits 2022-10-18 17:21:56 -07:00
Becca Royal-Gordon
6143b8379f Generate IR for @_objcImpl stored properties
Only works for trivial types right now because features related to initialization and deinitialization are seriously busted.
2022-10-18 17:21:56 -07:00
Becca Royal-Gordon
ba1ec90419 Generate IR for @_objcImpls
This commit begins to generate correct metadata for @_objcImplementation extensions:

• Swift-specific metadata and symbols are not generated.
• For main-class @_objcImpls, we visit the class to emit metadata, but visit the extension’s members.
• Includes both IR tests and executable tests, including coverage of same-module @objc subclasses, different-module @objc subclasses, and clang subclasses.

The test cases do not yet cover stored properties.
2022-10-18 17:21:56 -07:00
Pavel Yaskevich
7dfad23828 [SILGen] TypeWrappers: Support default values in user-defined initializers
All of the property initializers are injected as initializations
of individual `_storage` fields.
2022-10-07 17:36:12 -07:00
Pavel Yaskevich
7bcd8ff203 [Sema] TypeWrappers: Replace self. with _storage. for immutable properties
Immutable properties cannot be re-assigned and don't have setters
which means that we cannot use `assign_by_wrapper` instruction to
handle `let` properties, but we can use a direct reference to
`_storage` property instead when immutable property appears as an
assignment destination and let read references go through a getter
still.
2022-10-04 13:24:46 -07:00
Pavel Yaskevich
445148c48c [Sema] TypeWrappers: Allow let properties to be managed by a type wrapper 2022-10-03 16:58:50 -07:00
Pavel Yaskevich
dbb5a48ed5 Merge pull request #60941 from xedin/type-wrapper-user-defined-inits-with-inst-reuse
[Sema/SIL] Implement type wrapper support in user-defined initializers
2022-10-03 11:39:38 -07:00
Hamish Knight
457bd230d2 [test] Rename if_expr -> ternary_expr 2022-10-03 11:28:29 +01:00
Pavel Yaskevich
dcecf527e5 [SILOptimizer] TypeWrappers/NFC: Add tests for convenience initializers of wrapped types 2022-09-29 20:50:37 -07:00
Pavel Yaskevich
746457f346 [SILOptimizer] TypeWrappers: Implement self.$storage initialization injection
Inject a call to $Storage.init(...) which is then used to initialize
type wrapper property `$storage` via `self.$storage = <TypeWrapper>(memberwise: <storage>)`
call at each point where `_storage` becomes fully initialized.
2022-09-29 20:50:37 -07:00
Arnold Schwaighofer
f9a56205a3 test/Interpreter/keypath.swift does not work in back-deployment scenarios anymore
The file check expectations (the way we print stuff) is different after #60133.

rdar://100564676
2022-09-29 08:50:13 -07:00
Michael Gottesman
c16eadb31b Merge pull request #61193 from gottesmm/moveonly-deinits
[move-only] Implement support for move only deinits
2022-09-22 05:22:19 -07:00
Michael Gottesman
b1d6768920 [move-only] Turn off the buffer view test for now when optimizations are enabled.
The proof of concept is only intended to be used without optimizations right
now.
2022-09-21 16:19:43 -07:00
Anthony Latsis
9e07e69bdc Merge pull request #61176 from AnthonyLatsis/migrate-test-suite-to-gh-issues-29
Gardening: Migrate test suite to GH issues p. 29
2022-09-21 03:27:25 +03:00
Michael Gottesman
b1738c63c7 [move-only] Implement MoveOnlyDeinitInsertion that converts destroy_value of known deinit move only types to call the deinit directly.
NOTE: If one does not define a deinit on a move only type, if a destroy_value
lasts until IRGen time we will assert since I haven't implemented support in
IRGen for the destroy value witness for move only types. That being said, just
creating a deinit by adding to such a type:

```
deinit {}
```

is pretty low overhead for the experiments we want to use this for.
2022-09-20 15:19:31 -07:00
Anthony Latsis
9816adc586 Gardening: Migrate test suite to GH issues (file names): Interpreter 2022-09-18 18:01:16 +03:00
Mishal Shah
e072c8e3a5 Update test/Interpreter/SDK/Foundation_NSRect.swift 2022-09-17 00:15:13 -07:00
Drew Maxwell
7825221cd4 Updating Swift tests to remove outdated tests and use more current calls. 2022-09-16 15:11:10 -07:00
Ben Pious
57d82317c1 Add CustomDebugDescription conformance to AnyKeyPath (#60133)
* initial

* it works

demangling mostly works

fix dots

printing works

add tests

add conformance to AnyKeyPath

implement SPI

subscripts fully work

comments

use cross platform image inspection

remove unnecessary comment

fix

fix issues

add conditional conformance

add types

try to fix the api-digester test

cr feedback: move impls behind flag, remove addChain(), switch statement, fallthrough instead of if-elses, move import

cr feedback: refactor switch statement

fix #ifdef

reindent, cr feedback: removes manual memory management

fix missing whitespace

fix typo

fix indentation issues

switch to regexes

checks should test in on all platforms

print types in subscripts

add test for empty subscript

Update test/api-digester/stability-stdlib-abi-without-asserts.test

Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>

add commas

fix failing test

fix stdlib annotation

cr feedback: remove global, refactor ifdef

cr feedback: switch back to manual memory management

switch to 5.8 macro

add new weakly linked functions to the allowlist

fix one more failing test

more cr feedback

more cr feedback

* fix invisible unicode
2022-09-13 09:23:32 -07:00
Pavel Yaskevich
53bcf9ff67 [Sema] TypeWrappers: Implement @typeWrapperIgnored checking 2022-09-09 23:52:40 -07:00
Anthony Latsis
f547826276 Merge pull request #60894 from AnthonyLatsis/migrate-test-suite-to-gh-issues-16
Gardening: Migrate test suite to GH issues p. 16
2022-09-08 12:45:17 +03:00
Pavel Yaskevich
6d2edc2789 [Sema] TypeWrappers: Disable memberwise synthesis if type has designated init
If type has any user-defined designated initializers, let's not
synthesize a special memberwise initializer.
2022-09-02 17:58:48 -07:00
Anthony Latsis
af66096847 Gardening: Migrate test suite to GH issues: Interpreter 2022-09-01 06:35:57 +03:00
Pavel Yaskevich
325b54dd33 [Tests] NFC: Disable remote/device execution of type wrapper tests 2022-08-31 09:40:46 -07:00
Pavel Yaskevich
ad25221215 [Tests] TypeWrappers: Add test-cases to cover applying type wrapper to an actor 2022-08-31 09:39:45 -07:00
Pavel Yaskevich
609edfba05 [Tests] NFC: Limit type wrapper tests to assert builds only (#60846)
Production compilers do not support experimental features.
2022-08-30 10:08:22 -05:00
Pavel Yaskevich
347e85ddc4 [Sema] TypeWrappers: Add unamanged stored properties to the synthesized memberwise init
If a stored property would be in a default memberwise initializer
it would be added to the `init` synthesized for a type wrapped type
as well i.e. a `let` property without a default.
2022-08-26 12:25:22 -07:00
Pavel Yaskevich
8c0f6e15cd [TypeWrappers] NFC: Fix type wrapper executable test on Linux 2022-08-26 12:25:22 -07:00
Pavel Yaskevich
0500f35537 [Sema] TypeWrappers: Synthesize init parameters for property wrapped members
Since properties with property wrappers are not supported, default
init synthesis needs to handle them as well by using correct interface
type depending on outer wrapper capabilities and setting correct
default expression.
2022-08-26 12:25:22 -07:00
Pavel Yaskevich
39b1566240 [Sema] TypeWrappers: convert variable init expr into initializer default
All of the stored properties are wrapped which means that their
initializers are subsummed and moved to the synthesized `init`
as default arguments.
2022-08-26 12:25:22 -07:00
Pavel Yaskevich
a3b54308d2 [Frontend] Mark 'Type Wrappers' as experimental feature that has to be enabled 2022-08-26 12:25:22 -07:00
Pavel Yaskevich
7d28a4fa78 [TypeChecker] NFC: Add more property wrapper tests 2022-08-26 12:25:22 -07:00
Arnold Schwaighofer
dfecad916e Disable resilient_multipayload_enum.swift test that fails on older runtimes
Older runtimes have a bug that was fixed by PR #42131 that this test exercises.

rdar://99099912
2022-08-25 06:47:48 -07:00
Karoy Lorentey
0d8f5d9113 [test] Interpreter/autolinking: Require local execution 2022-08-23 14:55:12 -07:00
Arnold Schwaighofer
dd49a2f5f8 Add missing executable_test to Interpreter/resilient_multipayload_enum.swift 2022-08-18 09:00:01 -07:00
swift-ci
65d8a16c8f Merge pull request #60609 from aschwaighofer/irgen_fix_typelayout_multipayload_enum_lowering
IRGen: Fix shift amount in typelayout lowering of mulipayload enums to bits
2022-08-17 18:16:41 -07:00
Arnold Schwaighofer
f295cbee19 IRGen: Fix shift amount in typelayout lowering of mulipayload enums to bits
Transfer the fix in #42131 to the typelayout lowering code. Noticed as part of
investigating the fix for #60590.
2022-08-17 14:33:52 -07:00
Dario Rexin
2c295abb1b [IRGen] Properly handle empty payloads in getEnumTagMultipayload (#60590)
* [IRGen] Properly handle empty payloads in getEnumTagMultipayload

rdar://97914498

The generated code assumed that payloads would always be at least
1 byte long, ignoring the possibility of empty payloads, causing
runtime crashes when using empty payloads in multi payload enums.

* Fix test

* Remove unnecessary basic block
2022-08-17 13:29:26 -07:00