Commit Graph

464 Commits

Author SHA1 Message Date
Joe Groff
52e97d6544 Diagnose attempts to use tuples with noncopyable elements.
These aren't fully supported yet. rdar://108024586
2023-04-14 16:49:30 -07:00
Slava Pestov
4f2ab59ee5 Merge pull request #64875 from slavapestov/parameter-packs-feature-flag
Guard usage of variadic generics with $ParameterPacks in module interface files
2023-04-05 09:48:47 -04:00
Richard Wei
01e6fe2936 [Macros] Code item macros
Add support for declaring and expanding code item macros.  Add experimental feature flag `CodeItemMacros`.
2023-04-04 09:54:57 -07:00
Slava Pestov
093fa282b0 Guard usage of variadic generics with $ParameterPacks in module interface files
Fixes rdar://107559541.
2023-04-03 19:49:39 -04:00
Alejandro Alonso
4a681160dc Merge pull request #64673 from Azoy/builtin-module-feature
[Frontend] Add BuiltinModule experimental feature
2023-03-29 23:12:40 -07:00
Doug Gregor
73a20417ba Only define the various Macros features when the compiler supports them
We were enabling the `$Macros` feature unconditionally, even when the
compiler itself doesn't support macros (because it's missing
swift-syntax). Change this to only enable the feature when the
compiler supports it.
2023-03-29 16:30:44 -07:00
Nuri Amari
564621e330 Create feature flag for SE-0384 2023-03-29 10:25:22 -07:00
Michael Gottesman
aa75e6d99f [move-only] Temporarily ban deinits on non-copyable enums.
The reason why we are doing this is that:

1. For non-copyable types, switches are always at +1 for now.
2. non-copyable enums with deinits cannot be switched upon since that would
invalidate the deinit.

So deinits on non-copyable enums are just not useful at this point since you
cannot open the enum.

Once we make it so that you can bind a non-copyable enum at +0, we will
remove this check.

I added an experimental feature MoveOnlyEnumDeinits so tests that validate the
codegen/etc will still work.

rdar://101651138
2023-03-28 16:07:15 -07:00
swift-ci
3be14e0a4a Merge pull request #64622 from kavon/bifurcate-moveonly-featureflag
Fix minimal stdlib builds with noncopyable types
2023-03-28 14:44:24 -07:00
Alejandro Alonso
c21899ee0f Add BuiltinModule experimental feature 2023-03-28 09:41:37 -07:00
Konrad `ktoso` Malawski
0586c14b60 [Concurrency] SerialExecutor.isSameExclusiveExecutionContext (#64604) 2023-03-28 15:56:28 +09:00
Kavon Farvardin
6f98e9a2c6 trifurcate the MoveOnly feature
I want to reserve Feature::MoveOnly only for move-only types and other
things that are part of SE-390. Other prototyped features like
noimplicitcopy and some older names for consume were left behind
as guarded by this Feature. That's really not the right way to do it,
as people will expect that the feature is enabled all the time, which
would put those unofficial features into on-by-default. So this change
introduces two new Features to guard those unofficial features.
2023-03-24 15:43:35 -07:00
Kavon Farvardin
bf7091f046 ensure #if $MoveOnly evaluates to true
I enabled move-only types by default, but I didn't
realize that the `Feature::MoveOnly` needs to graduate
into a `LANGUAGE_FEATURE` so that `EvaluateIfConfigCondition`
will recognize `$MoveOnly` as being true.

fixes rdar://107050387
2023-03-24 08:48:26 -07:00
Doug Gregor
b412c6c884 [Macros] Treat FreestandingExpressionMacros as a suppressible feature
When the feature isn't available, use the older `@expression` syntax to
work around limitations of older compilers.
2023-03-09 20:33:30 -08:00
Alexis Laferrière
9071351807 [Sema] Enable the AccessLevelOnImport feature in prod compilers
rdar://106219959
2023-03-06 08:56:07 -08:00
Dario Rexin
5fe716577b [IRGen] Add layout strings for generic and resilient types (#64023)
* [IRGen] Add layout strings for generic and resilient types

rdar://105837048

* Add some corner cases

* Add flag to enable generic instantiation and some fixes

* Fix resilient types

* Fix metadata accessor function pointers in combined layout strings
2023-03-05 15:26:45 -08:00
Michael Gottesman
78d57ea6be [reference-bindings] Put reference bindings support behind -enable-experimental-feature ReferenceBindings. 2023-03-03 17:14:16 -08:00
Alex Lorenz
ba34e4f4e7 Merge pull request #64046 from hyp/eng/cxx-interop-no-expose
[interop][SwiftToCxx] do not require @_expose when generating C++ interface for a Swift module
2023-03-02 20:55:31 -08:00
Alex Lorenz
1d3797308d [interop][SwiftToCxx] do not expose functions / properties that throw without the experimental feature 2023-03-02 15:22:36 -08:00
Doug Gregor
f88d2c638f Clean up feature flags for macros.
Enable expression macros by default, and add separate feature flags for
attached and freestanding macros.
2023-03-02 14:34:59 -08:00
Alexis Laferrière
1afc6af739 Merge pull request #63912 from xymus/access-level-import-parsing
[Parser|Sema] Accept access level on imports with experimental flag
2023-02-27 09:27:26 -08:00
Alexis Laferrière
08895657cb [Parser] Intro parser support and flag for access level on imports 2023-02-25 09:47:19 -08:00
Dario Rexin
a8d4d57f11 [IRGen] Generate compressed representation of value witnesses (#63813)
rdar://105837040

* WIP: Store layout string in type metadata

* WIP: More cases working

* WIP: Layout strings almost working

* Add layout string pointer to struct metadata

* Fetch bytecode layout strings from metadata in runtime

* More efficient bytecode layout

* Add support for interpreted generics in layout strings

* Layout string instantiation, take and more

* Remove duplicate information from layout strings

* Include size of previous object in next objects offset to reduce number of increments at runtime

* Add support for existentials

* Build type layout strings with StructBuilder to support target sizes and metadata pointers

* Add support for resilient types

* Properly cache layout strings in compiler

* Generic resilient types working

* Non-generic resilient types working

* Instantiate resilient type in layout when possible

* Fix a few issues around alignment and signing

* Disable generics, fix static alignment

* Fix MultiPayloadEnum size when no extra tag is necessary

* Fixes after rebase

* Cleanup

* Fix most tests

* Fix objcImplementattion and non-Darwin builds

* Fix BytecodeLayouts on non-Darwin

* Fix Linux build

* Fix sizes in linux tests

* Sign layout string pointers

* Use nullptr instead of debug value
2023-02-24 15:40:28 -08:00
BJ Homer
738c89b8de Merge branch 'main' into disable-property-wrapper-based-isolation 2023-02-24 09:23:18 -07:00
BJ Homer
f876f26aaf Add a feature flag for DisableActorInferenceFromPropertyWrapperUsage.
This will be enabled by default in Swift 6, but can now also be enabled by passing `-enable-upcoming-feature DisableActorInferenceFromPropertyWrapperUsage` to the compiler.
2023-02-22 08:45:44 -07:00
Erik Eckstein
748264c45f Add a unprotectedStackAlloc builtin
It's like `Builtin.stackAlloc`, but doesn't set the `[stack_protection]` flag on its containing function.
2023-02-15 08:09:38 +01:00
Pavel Yaskevich
8eebb5bec1 Merge pull request #63522 from xedin/revert-type-wrappers
[AST/Sema/SIL] Revert TypeWrappers feature functionality
2023-02-09 09:27:18 -08:00
Doug Gregor
85ba74b812 Introduce a separate feature to cover @freestanding(expression) 2023-02-08 11:26:14 -08:00
Pavel Yaskevich
61ab4d539d [Frontend] Remove TypeWrappers flag and associated attributes 2023-02-08 09:27:07 -08:00
Alex Lorenz
1a763c0cbc Merge pull request #63336 from hyp/eng/emit-symbolic-interfaces
[interop] Emit symbolic interfaces while indexing
2023-02-07 20:24:36 -08:00
Dario Rexin
a8bea1e70a [SILOpt] Reject existentials in AnyObject specialization application (#63477)
Also allow this feature to be enabled in non-assert compilers
2023-02-06 19:40:05 -08:00
Alex Lorenz
f36e5cf641 [interop] add 'ImportSymbolicCXXDecls' experimental import mode for importing class templates syntactically but not semantically 2023-01-31 14:58:13 -08:00
Kavon Farvardin
9d65c9e81e enable move-only and move-only classes in production builds 2023-01-24 16:01:23 -08:00
Kavon Farvardin
1356694043 experimentally allow move-only classes
A lot of existing regression tests rely on there
being some form of move-only classes, despite
them being something that will not be available
to users (and not complete).

This change introduces a `MoveOnlyClasses`
experimental feature so that those tests don't
need to be fully rewritten just yet. You need to
include `-enable-experimental-feature MoveOnlyClasses` along with
`-enable-experimental-move-only` to get move-only classes.
2023-01-23 22:33:27 -08:00
Doug Gregor
9e76023546 Add BuiltinCreateTaskGroupWithFlags feature and use it to guard the builtin 2023-01-11 13:47:28 -08:00
Doug Gregor
74a5b6adbd Allow the "macros" experimental feature to be enabled in production compilers
Now that we have a macro in the standard library, we need production
compilers to be able to build the standard library.

Fixes rdar://103868067.
2023-01-04 08:33:21 -08:00
Pavel Yaskevich
529269946d [AST] Drop ResultBuilderASTTransform feature flag 2022-12-21 12:18:02 -08:00
Pavel Yaskevich
697dfbae96 [TypeChecker] Enable result builder AST transform by default 2022-12-21 10:31:30 -08:00
Doug Gregor
33589de62f Experimentally emit diagnostics from the new Swift parser
Introduce the experimental feature `ParserDiagnostics`, which emits
diagnostics from the new Swift parser *first* for a source file. If
that produces any errors, we suppress any diagnostics emitted from the
C++ parser.
2022-12-15 21:24:44 -08:00
Alexis Laferrière
276281ded8 Merge pull request #62476 from xymus/module-interface-export-as
[ModuleInterface] Ignore export_as in private swiftinterface
2022-12-13 09:12:44 -08:00
Ben Rimmington
620ba334fb [SE-0368] StaticBigInt: support older compilers (#62541) 2022-12-13 11:15:48 +00:00
Alexis Laferrière
ab38752d33 [ModuleInterface] Ignore export_as in private swiftinterface
Introduce a new behavior when printing references to modules with an
`export_as` definition. Use the `export_as` name in the public swiftinterface
and the real module name in the private swiftinterface.

This has some limits but should still be an improvement over the current
behavior. First, the we use the `export_as` names only for references to clang
decls, not Swift decls with an underlying module defining an `export_as`.
Second, we always print the `export_as` name in the public swiftinterface,
even in the original swiftinterface file when the `export_as` target is likely
not know, so that generated swiftinterface is still broken.

This behavior is enabled by the flags `-enable-experimental-feature ModuleInterfaceExportAs`
or the `SWIFT_DEBUG_USE_EXPORTED_MODULE_NAME_IN_PUBLIC_ONLY` env var. We may
consider turning it on by default in the future.

rdar://98532918
2022-12-12 14:58:19 -08:00
Pavel Yaskevich
331f76645d [Features] Add an experimental RuntimeDiscoverableAttrs feature flag
Guards functionality related to `@runtimeMetadata` attribute.
2022-11-15 15:53:48 -08:00
Pavel Yaskevich
eb57ad2155 [Basic] Features: Enable ResultBuilderASTTransform feature in production compilers 2022-11-01 10:15:58 -07:00
Pavel Yaskevich
f779f8059f [Basic] Make it possible to access some experimental features in production compilers
Resolves: rdar://99884335
2022-11-01 10:15:51 -07:00
Doug Gregor
636e6d1524 [Macros] "Expand" builtin macros for magic literals.
Introduce an experimental option `BuiltinMacros` that takes the magic
literals (`#file`, `#line`, `#function`, etc.) after type checking and
processes the original source for the expression using the build
syntactic macro system in the swift-syntax library. At present, the
result of expansion is printed to standard output, but it's enough to
verify that we're able to find the corresponding syntax node based on
the C++ AST.
2022-10-21 06:41:05 -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
Doug Gregor
2560aedc10 Rename experimental feature to ParserASTGen 2022-10-07 10:19:05 -07:00
zoecarver
73a7c0ecc6 Apply Doug's review comments
(cherry picked from commit ddede209c7)
2022-10-07 10:18:40 -07:00
Allan Shortlidge
290f26b9fd Frontend: Remove the temporary Actors2 feature definition. 2022-10-03 14:49:11 -07:00