Commit Graph

300 Commits

Author SHA1 Message Date
Pavel Yaskevich
e850f1708f [Concurrency] SE-0466: Replace UnspecifiedMeansMainActorIsolated flag with -default-isolation 2025-03-23 22:04:39 -07:00
Hamish Knight
f8ab391737 Introduce type sugar for InlineArray (#80087)
* [CS] Decline to handle InlineArray in shrink

Previously we would try the contextual type `(<int>, <element>)`,
which is wrong. Given we want to eliminate shrink, let's just bail.

* [Sema] Sink `ValueMatchVisitor` into `applyUnboundGenericArguments`

Make sure it's called for sugar code paths too. Also let's just always
run it since it should be a pretty cheap check.

* [Sema] Diagnose passing integer to non-integer type parameter

This was previously missed, though would have been diagnosed later
as a requirement failure.

* [Parse] Split up `canParseType` 

While here, address the FIXME in `canParseTypeSimpleOrComposition`
and only check to see if we can parse a type-simple, including
`each`, `some`, and `any` for better recovery.

* Introduce type sugar for InlineArray

Parse e.g `[3 x Int]` as type sugar for InlineArray. Gated behind
an experimental feature flag for now.
2025-03-23 15:31:37 -07:00
Doug Gregor
13f1bea2d3 Merge pull request #80209 from DougGregor/infer-isolated-conformances
Implement experimental feature InferIsolatedConformances
2025-03-22 17:53:20 -07:00
Doug Gregor
083194923c Implement experimental feature InferIsolatedConformances
Introduce the experimental feature InferIsolatedConformances to align
with the upcoming feature proposed in SE-0470. This is a slight
generalization of the main-actor-specific inference that was already
in place for the default-main-actor mode from SE-0466. Note that, as
specified in SE-0470, InferIsolatedConformances is implied by the
default-main-actor mode.
2025-03-21 11:41:46 -07:00
Holly Borla
be670da373 Merge pull request #79980 from hborla/closure-body-macro
[Macros] Implement support for function body macros on closures.
2025-03-21 06:19:36 -07:00
Anthony Latsis
3d3b1ca50a [NFC] AST: Turn getParameterList into a method on ValueDecl 2025-03-19 18:49:15 +00:00
Amritpan Kaur
98cd675eb9 Guard feature behind experimental flag. 2025-03-19 10:54:09 -07:00
Holly Borla
8ec70e2559 [Macros] Gate closure body macros behind an experimental feature flag. 2025-03-18 20:50:47 -07:00
Pavel Yaskevich
bb6326bb32 [AST] Adjust usesFeatureExecutionAttribute to cover accessors 2025-03-14 17:29:48 -07:00
Konrad `ktoso` Malawski
8c4dea9802 Revert "[concurrency] Add support for HopToMainActorIfNeededThunk." (#79938)
* Revert "[concurrency] Add support for HopToMainActorIfNeededThunk."

This reverts commit 0e0665bfbd.

* remove some last bits of 0e0665b
2025-03-13 06:48:03 +09:00
Tony Allevato
7797664bb4 Add RawIdentifiers as a language feature.
This lets clients test `#if hasFeature(RawIdentifiers)` to
determine compiler support.
2025-03-11 17:26:27 -04:00
Anthony Latsis
5a92bc5e12 Merge pull request #79897 from AnthonyLatsis/danaus-plexippus-3
Small adjustments to adoption mode modeling
2025-03-11 11:47:18 +00:00
Michael Gottesman
04bb69f426 Merge pull request #79727 from gottesmm/pr-025c1133954b74e7b4eda77e1a6f3bcafd4eb6cf
[concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
2025-03-10 22:35:00 -07:00
Anthony Latsis
ae70d384e0 [NFC] Basic: Restrict adoption mode to upcoming and experimental features 2025-03-11 01:15:33 +00:00
Michael Gottesman
f64dd5a8d5 [concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
We introduce a new macro called #SwiftSettings that can be used in conjunction
with a new stdlib type called SwiftSetting to control the default isolation at
the file level. It overrides the current default isolation whether it is the
current nonisolated state or main actor (when -enable-experimental-feature
UnspecifiedMeansMainActorIsolated is set).
2025-03-10 17:33:45 -07:00
nate-chandler
c0ba520fac Merge pull request #79781 from nate-chandler/general-coro/20250227/1
[CoroutineAccessors] Dispatch and PtrAuth.
2025-03-07 20:08:42 -08:00
Nate Chandler
f5d03a6d11 [CoroutineAccessor] Remove old ABI support.
This was useful during bringup.  Now that retcon.once.dynamic coroutine
splitting is available, it's no longer needed.
2025-03-07 11:40:38 -08:00
Anthony Latsis
6a3903bb53 Revert "Revert "Introduce adoption mode for Swift features""
This reverts commit 393c59c078.
2025-03-05 15:21:01 +00:00
Rintaro Ishizaki
393c59c078 Revert "Introduce adoption mode for Swift features" 2025-03-04 19:13:05 -08:00
Anthony Latsis
43b00af490 Merge pull request #79649 from AnthonyLatsis/danaus-plexippus
Introduce adoption mode for Swift features
2025-03-04 23:16:28 +00:00
Artem Chikin
6da529f098 Merge pull request #79753 from artemcm/NewConstFeatureDefinition
[Compile Time Values] Add a new experimental feature and the parsing of the `@const` attribute
2025-03-04 12:26:04 -08:00
John Hui
edc742013d [cxx-interop] Make experimental flag ImportNonPublicCxxMembers (#79728)
ClangImporter can now import non-public members as of be73254cdc and 66c2e2c52b, but doing so triggers some latent ClangImporter bugs in projects that don't use or need those non-public members.

This patch introduces a new experimental feature flag, ImportNonPublicCxxMembers, that guards against the importation of non-public members while we iron out those latent issues. Adopters of the SWIFT_PRIVATE_FILEID feature introduced in bdf22948ce can enable this flag to opt into importing private members they wish to access from Swift.

rdar://145569473
2025-03-04 13:31:46 -05:00
Artem Chikin
13a8d4b88e [Compile Time Values] Add a new experimental feature and the parsing of the '@const' attribute 2025-03-04 07:30:57 -08:00
Anthony Latsis
8dab67bcee Basic: Adjust feature macros for adoption mode 2025-03-04 13:43:28 +00:00
Holly Borla
8be41edf6f [Concurrency] Add a macro for wrapping a function body in a new task. 2025-03-03 20:51:14 -08:00
Doug Gregor
983046f792 [SE-0458] Suppress @unsafe conformances for compilers that can't handle them 2025-02-26 22:06:45 -08:00
Doug Gregor
b7b5a2a19d [SE-0458] Enable unsafe expressions / attributes / for..in effects by default
With the acceptance of SE-0458, allow the use of unsafe expressions, the
@safe and @unsafe attributes, and the `unsafe` effect on the for..in loop
in all Swift code.

Introduce the `-strict-memory-safety` flag detailed in the proposal to
enable strict memory safety checking. This enables a new class of
feature, an optional feature (that is *not* upcoming or experimental),
and which can be detected via `hasFeature(StrictMemorySafety)`.
2025-02-26 12:30:07 -08:00
Doug Gregor
52c46f838a Parsing and type checking for the definition of isolated conformances
Allow a conformance to be "isolated", meaning that it stays in the same
isolation domain as the conforming type. Only allow this for
global-actor-isolated types.

When a conformance is isolated, a nonisolated requirement can be
witnessed by a declaration with the same global actor isolation as the
enclosing type.
2025-02-25 21:16:51 -08:00
Pavel Yaskevich
9e4859b302 [Basic] NFC: Add ExtensibleEnums feature flag 2025-02-25 00:05:01 -08:00
Pavel Yaskevich
dd1be8f6d4 [Frontend] Hide @execution attribute behind an experimental feature ExecutionAttribute
Since the proposal has not been approved yet we cannot expose
`@execution` attribute.
2025-02-20 00:05:03 -08:00
Pavel Yaskevich
e2ff3308be [Frontend] NFC: Rename NonIsolatedAsyncInheritsIsolationFromContext feature
New name is `AsyncCallerExecution` as stated by the proposal.
2025-02-19 20:00:56 -08:00
Alejandro Alonso
7480668c7b Add feature for Builtin.emplace typed throws 2025-02-17 12:45:05 -08:00
Gabor Horvath
648fd43709 [cxx-interop] Remove a feature flag
SafeInterop was guarding whether we import certain foreign types as
unsafe. Since these attrbutes are only considered when an opt-in strict
language mode is on, this PR removes this feature flag. We still rely on
the presence of the AllowUnsafeAttribute flag to add the unsafe
attributes to the imported types and functions.
2025-02-17 12:37:31 +00:00
Doug Gregor
3c8ef82963 Enable usable of Span by default
Usage of Span was temporarily behind an experimental feature flag. Now
that SE-0447 has been accepted, remove the experimental feature flag and
allow Span usage everywhere.

Implements rdar://144819992.
2025-02-14 10:45:47 -08:00
Doug Gregor
37d71f362e Add StrictSendableMetatypes to require Sendable requirements on metatypes
Introduce a new experimental feature StrictSendableMetatypes that stops
treating all metatypes as `Sendable`. Instead, metatypes of generic
parameters and existentials are only considered Sendable if their
corresponding instance types are guaranteed to be Sendable.

Start with enforcing this property within region isolation. Track
metatype creation instructions and put them in the task's isolation
domain, so that transferring them into another isolation domain
produces a diagnostic. As an example:

    func f<T: P>(_: T.Type) {
      let x: P.Type = T.self
      Task.detached {
        x.someStaticMethod() // oops, T.Type is not Sendable
      }
    }
2025-02-12 20:21:57 -08:00
Erik Eckstein
c6da8895d3 remove the FixedArrays experimental feature
It's not needed anymore because we now have inline-arrays.
2025-02-12 10:51:14 +01:00
Allan Shortlidge
3cc3031840 Basic/AST: Define the CustomAvailability experimental feature. 2025-01-28 13:47:42 -08:00
Andrew Trick
0e33dfc8b6 Fix LifetimeDependence feature guard for variable accessors.
Guard variable declarations by `#if $LifetimeDependence` if they have a
~Escapable type. Accessing the declaration implies a lifetime dependence.
2025-01-14 15:41:58 -08:00
Rintaro Ishizaki
660a2ea39a Merge pull request #78335 from rintaro/revert-revert-77140-swift-lexical-lookup-validation
Reapply "[SwiftLexicalLookup] New unqualified lookup implementation validation"
2025-01-06 09:12:45 -08:00
Joe Groff
5c4406b5e8 Add an @_addressableForDependencies type attribute.
This attribute makes it so that a parameter of the annotated type, as well as
any type structurally containing that type as a field, becomes passed as
if `@_addressable` if the return value of the function has a dependency on
the parameter. This allows nonescapable values to take interior pointers into
such types.
2025-01-02 21:33:51 -08:00
Michael Gottesman
328629e7fa [concurrency] Add feature NonIsolatedAsyncInheritsIsolationFromContext.
rdar://125193256
2025-01-02 13:18:29 -08:00
Rintaro Ishizaki
a0d7068162 Revert "Merge pull request #78280 from swiftlang/revert-77140-swift-lexical-lookup-validation"
This reverts commit ae88aaca8f, reversing
changes made to b0123bca14.
2024-12-20 16:37:36 -08:00
Becca Royal-Gordon
a6df4ef85c Merge pull request #76878 from beccadax/abi-changed-your-name 2024-12-20 10:30:48 -08:00
Slava Pestov
3f1491e2b4 Merge pull request #78298 from slavapestov/remove-one-way-bind
Sema: Remove -experimental-one-way-closure-params
2024-12-19 19:37:10 -05:00
Becca Royal-Gordon
0d34b4da5b Print @abi into module interface (suppressibly) 2024-12-19 15:49:34 -08:00
Becca Royal-Gordon
94ff062edd Parse and serialize @abi attribute
This attribute will allow you to specify an alternate version of the declaration used for mangling. It will allow minor adjustments to be made to declarations so long as they’re still compatible at the calling convention level, such as refining isolation or sendability, renaming without breaking ABI, etc.

The attribute is behind the experimental feature flag `ABIAttribute`.
2024-12-19 15:48:54 -08:00
Slava Pestov
bb55d9c59a Sema: Remove -experimental-one-way-closure-params 2024-12-19 13:14:11 -05:00
Paul LeMarquand
ae88aaca8f Merge pull request #78280 from swiftlang/revert-77140-swift-lexical-lookup-validation
Revert "[SwiftLexicalLookup] New unqualified lookup implementation validation"
2024-12-19 12:40:31 -05:00
Andrew Trick
5581ab876b Remove the experimental LifetimeDependenceDiagnoseTrivial feature.
This was never used to generate a .swiftinterface, so can be safely removed. It
was used to guard compiler fixes that might break older .swiftinterface
files. Now, we guard the same fixes by checking the source file type.
2024-12-18 17:11:32 -08:00
Ben Barham
e06d0b9357 Revert "[SwiftLexicalLookup] New unqualified lookup implementation validation" 2024-12-18 15:04:16 -08:00