Commit Graph

325 Commits

Author SHA1 Message Date
Joe Groff
0a16152b40 Add a BorrowInout experimental feature flag.
This gates access to the new standard library `Borrow` and `Inout` types
until they are officially accepted.
2026-02-13 15:23:51 -08:00
John Hui
3e55ed0b7a Merge pull request #87016 from j-hui/lazily-import-methods 2026-02-12 19:42:11 -08:00
elsa
af7069a10e Merge pull request #86811 from elsakeirouz/for-in-borrowing-support-no-stdlib-changes
ForEach support for Borrowing sequence

For testing purposes, this commit includes _BorrowingSequence and _BorrowingIterator protocols, with conformance for Span and InlineArray.
2026-02-12 10:08:24 +00:00
John Hui
259b31e035 [cxx-interop] Gate lazy member imports under ImportCxxMembersLazily feature flag
This behavior is currently gated on ImportCxxMembersLazily to provide
an easy off-ramp in case of qualification issues.
2026-02-11 17:47:29 -08:00
Elsa Keirouz
0e7419ea08 add experimental feature flag for borrowing for loop 2026-02-11 16:02:25 +00:00
Artem Chikin
2f0ba5820c Merge pull request #86500 from artemcm/LiteralExpressions
[Literal Expressions] Add support for simple constant-folded literal expressions
2026-02-09 16:20:09 +00:00
Artem Chikin
0bbd35242c [Literal Expressions] Add support for simple constant-folded literal expressions
This change adds an experimental feature 'LiteralExpressions` which allows for use of simple binary expressions of integer type composed of literal value operands.

For now, such literal expressions are only supported in initializers of '@section` values.
2026-02-09 11:35:45 +00:00
Hamish Knight
bc65846be2 [Sema] SE-0502: Enable ExcludePrivateFromMemberwiseInit by default
Enable the feature by default, and add an experimental feature
`DeprecateCompatMemberwiseInit` to control the deprecation behavior
which was deferred from the proposal.
2026-02-06 11:50:40 +00:00
Aidan Hall
e98a7a6bf8 Merge pull request #86842 from aidan-hall/just-func-type-lifetimes-try-print
LifetimeDependence: Support function types
2026-02-06 10:09:25 +00:00
Aidan Hall
805d8e9e26 Add language feature ClosureLifetimes 2026-02-05 14:50:14 +00:00
Meghana Gupta
a3a3134037 Guard borrow/mutate accessors in swiftinterface files 2026-02-04 07:16:28 -08:00
Kavon Farvardin
4a7cedcf1e Reparenting: introduce new attributes
A protocol that's been reparented declares it
by writing `@reparented` in its inheirtance clause
for each new parent. You can introduce a `@reparented`
parent to a pre-existing ABI-stable protocol's
inheritance hierarchy.

Only protocols declared to be  `@reparentable` can be
used to reparent other protocols. Adding or removing
the `@reparentable` attribute is ABI-breaking, as it
effects the type metadata layout. Thus, reparentable
protocols must be born as such to use them with
protocols that are already ABI-stable.

This set of changes does not include the actual
implementation of ABI-stable reparenting.
2026-02-03 16:39:19 -08:00
Doug Gregor
cc2fc8ae65 [Embedded] Put dynamic exclusivity behind a second experimental feature
We need to stage in the behavior change to enable dynamic exclusivity
checking for Embedded Swift. For now, ignore
`-enforce-exclusivity=checked` in Embedded Swift unless the
experimental feature `EmbeddedDynamicExclusivity` is also enabled.

Addresses rdar://168618037, a regression in Embedded Swift code that
is passing `-enforce-exclusivity=checked` explicitly.
2026-01-22 21:22:19 -08:00
Kavon Farvardin
adf14929f9 Merge pull request #86337 from kavon/noncopyable-opaque-read-ownership
introduce UnderscoreOwned feature
2026-01-07 18:58:54 -08:00
Kavon Farvardin
458b62c9ed introduce UnderscoreOwned feature
This experimental feature allows you to override the default behavior
of a 'get' returning a noncopyable type, so that it returns an owned
value rather than a borrow, when that getter is exposed in opaque
interfaces like protocol requirements or resilient types.

resolves rdar://157318147
2026-01-06 16:39:54 -08:00
Doug Gregor
3f00643d13 [Module interface printing] Print @c as @_cdecl for older compilers
Add a feature just for the purpose of suppressing it. Print the check
as `hasAttribute(c)` so this feature can be temporary.

Fixes rdar://167546897 .
2026-01-05 09:47:19 -08:00
Pavel Yaskevich
1f229d816b [Concurrency] Remove experimental feature GroupActorErrors
We have decided not to pursue this direction.
2025-12-18 11:01:53 -08:00
Slava Pestov
ea587322dc Sema: New StrictAccessControl upcoming feature
Some access control holes were unconditionally downgraded to warnings, and
others were conditional on Swift 6 language mode. Let's hang them off an
upcoming feature instead.
2025-12-15 18:02:52 -05:00
Artem Chikin
e593fd97a0 Add parsing for a declaration attribute '@warn' for source-level warning group behavior control 2025-12-12 10:14:14 -08:00
Michael Gottesman
e186e5e5d0 Merge pull request #85972 from gottesmm/pr-9663abc1697da1382a8514e6877a6c3ce3f439b9
[concurrency] Hide Concurrency StackNesting builtins behind a feature flag
2025-12-11 21:16:37 -08:00
Michael Gottesman
7b9281fcb8 [concurrency] Hide Concurrency StackNesting builtins behind a feature flag.
rdar://166244033
2025-12-10 16:02:18 -08:00
Meghana Gupta
4089775de8 Fix swiftinterface printing of accessors and inferred lifetime dependencies when Lifetimes feature is enabled 2025-12-09 14:59:41 -08:00
Hamish Knight
45683f6561 [Sema] Exclude private initialized vars from memberwise initializer
Exclude properties with initial values from the memberwise initializer
if they are less accessible than the most accessible property, up to
`internal`. Introduce a compatibility overload that continues to
include the same properties as before until the next language mode.

This is gated behind the `ExcludePrivateFromMemberwiseInit` feature.

rdar://122416579
2025-12-08 23:22:35 +00:00
Kavon Farvardin
6f95203dfd Sema: introduce SuppressedAssociatedTypesWithDefaults
This is similar to SuppressedAssociatedTypes, but infers
default requirements when primary associated types of
protocols are suppressed. This defaulting for the primary
associated types happens in extensions of the protocol,
along with generic parameters, whenever a source-written
requirement states a conformance requirement for the protocol.

Thus, the current scheme for this defaulting is a simplistic,
driven by source-written requirements, rather than facts
that are inferred while building generic signatures.

Defaults are not expanded for infinitely many associated types.

rdar://135168163
2025-12-02 18:00:03 -08:00
Alexis Laferrière
a4865be7e3 Sema: Gate SPI operator fix behind EnforceSPIOperatorGroup
This new check is source breaking. Let's gate it behind an opt-in flag
for now and enable it by default on a new language mode or similar.
2025-11-12 10:46:21 -08:00
Alexis Laferrière
06db612d79 Sema: Intro the CheckImplementationOnlyStrict feature 2025-11-11 10:26:00 -08:00
John Hui
eedefc5d57 [NFC] Delete unused feature SuppressCXXForeignReferenceTypeInitializers (#85301) 2025-11-05 17:12:09 -08:00
Alexis Laferrière
62ee4486d7 Features: Intro CheckImplementationOnly 2025-11-04 13:50:25 -08:00
Allan Shortlidge
3b77e2e64a AST: Introduce experimental support for an anyAppleOS availability domain.
`anyAppleOS` represents a meta-platform for availability checks that can be
used to check availability across all of Apple's operating systems. It
supports versions 26.0 and up since version 26.0 is the first OS version number
that is aligned accross macOS, iOS, watchOS, tvOS, and visionOS.

Apple platform-specific availability specification take precedence over
`anyAppleOS` availability specifications when specified simultaneously.

Resolves rdar://153834380.
2025-10-31 15:21:30 -07:00
Alexis Laferrière
94113f4a83 SE-496: Remove references to features CDecl and CImplementation 2025-10-29 17:31:20 -07:00
Kuba (Brecka) Mracek
eb23d3bc0a Merge pull request #85074 from kubamracek/section
SE-0492: Stabilize @_section/@_used into @section/@used
2025-10-24 12:29:48 -07:00
John Hui
781489f067 Merge pull request #85021 from j-hui/return-frt-diagnostics
[cxx-interop] Put RETURNS_RETAINED warnings in a diagnostic group

rdar://161932849
rdar://144976203
2025-10-24 12:05:48 -04:00
Arnold Schwaighofer
7f36b58942 Merge pull request #85009 from aschwaighofer/embedded_existentials_feature_flag
Add experimental feature flag EmbeddedExistentials
2025-10-22 19:04:42 -07:00
Kuba Mracek
adeb40f261 SE-0492: Stabilize @_section/@_used into @section/@used
Removes the underscored prefixes from the @_section and @_used attributes, making them public as @section and @used respectively. The SymbolLinkageMarkers experimental feature has been removed as these attributes are now part of the standard language. Implemented expression syntactic checking rules per SE-0492.

Major parts:
- Renamed @_section to @section and @_used to @used
- Removed the SymbolLinkageMarkers experimental feature
- Added parsing support for the old underscored names with deprecation warnings
- Updated all tests and examples to use the new attribute names
- Added syntactic validation for @section to align with SE-0492 (reusing the legality checker by @artemcm)
- Changed @DebugDescription macro to explicitly use a tuple type instead of type inferring it, to comply with the expression syntax rules
- Added a testcase for the various allowed and disallowed syntactic forms, `test/ConstValues/SectionSyntactic.swift`.
2025-10-22 16:05:39 -07:00
Allan Shortlidge
16dee385bf AST/Basic: Introduce the StandaloneSwiftAvailability experimental feature.
This experimental feature will be used to force the compiler to treat `Swift`
runtime availability as separate from platform availability when compiling for
targets that have the Swift runtime built-in.
2025-10-21 21:55:24 -07:00
Arnold Schwaighofer
22c8ea6af6 Add experimental feature flag EmbeddedExistentials
This flag can be used to gradually add the functionility that will allow use of
protocol values in embedded mode.
2025-10-20 10:18:45 -07:00
Fahad Nayyar
facef0e034 [cxx-interop] Enabling WarnUnannotatedReturnOfCxxFrt on by default and add it to a diagnostic group
This change makes the warning for unannotated C++ functions returning foreign
reference types (FRT) enabled by default, improving memory safety for Swift/C++
interop users. Also added CxxForeignReferenceType diagnostic group for better control
2025-10-17 17:06:44 -07:00
Egor Zhdan
4e6e462c02 [cxx-interop] Remove opt-out flag for constructors of foreign reference types
The opt-out flag was never used or tested, let's remove it.

rdar://148285972
2025-10-14 18:11:12 +01:00
Pavel Yaskevich
1ac87e7004 [Basic] Add an experimental feature flag to guard use of ~Sendable 2025-10-09 10:41:25 -07:00
Allan Shortlidge
2d8465b043 AST: Introduce the SwiftLanguageMode availability domain spelling.
Require `-enable-experimental-feature SwiftRuntimeAvailability` to use this new
spelling.
2025-10-08 15:46:34 -07:00
Max Desiatov
e7aac5df12 for expressions scaffolding, making constraints work 2025-10-07 11:16:54 +01:00
Arnold Schwaighofer
25a071efc8 Add experimental feature @inline(always)
The intent for `@inline(always)` is to act as an optimization control.
The user can rely on inlining to happen or the compiler will emit an error
message.

Because function values can be dynamic (closures, protocol/class lookup)
this guarantee can only be upheld for direct function references.

In cases where the optimizer can resolve dynamic function values the
attribute shall be respected.

rdar://148608854
2025-09-30 08:36:26 -07:00
Doug Gregor
c68ef1cf71 Add an optional language feature for Library Evolution
Replace the one-off compiler flag for Library Evolution with an
optional language feature. This makes the
`hasFeature(LibraryEvolution)` check work in an `#if`, and is
otherwise just cleanup.

Tracked by rdar://161125572.
2025-09-22 17:45:34 -07:00
Kavon Farvardin
61fe8a9b8e introduce @_manualOwnership performance attribute
This attribute forces programmers to acknowledge every
copy that is required to happen in the body of the
function. Only those copies that make sense according
to Swift's ownership rules should be "required".

The way this is implemented as of now is to flag each
non-explicit copy in a function, coming from SILGen, as
an error through PerformanceDiagnostics.
2025-09-17 13:51:57 -07:00
Meghana Gupta
459a95888c Add a new experimental feature for borrow and mutate accessors 2025-09-09 13:52:27 -07:00
Allan Shortlidge
a5a49aaab6 ModuleInterface: Stop printing $CustomAvailability guards in swiftinterfaces.
All supported compilers can now parse `@available` attributes that reference
custom availability domains.
2025-09-04 09:12:27 -07:00
Doug Gregor
ed93b46fa6 [Embedded] Introduce DeferredCodeGen feature.
Introduce an experimental feature DeferredCodeGen, that defers the
generation of LLVM IR (and therefore object code) for all entities
within an Embedded Swift module unless they have explicitly requested
to not be emitted into the client (e.g., with
`@_neverEmitIntoClient`).

This feature is meant to generalize and subsume
-emit-empty-object-file, relying on lazy emission of entities rather
than abruptly ending the compilation pipeline before emitting any IR.

Part of rdar://158363967.
2025-09-03 15:55:47 -07:00
Gabor Horvath
2a9f6f89e3 Revert "Merge pull request #83483 from Xazax-hun/turn-off-addressable"
Afteri #83712 landed, let's make another try enabling addressable
parameters by default.

This reverts commit 61d60eb6ad, reversing
changes made to 670f69eadc.
2025-08-15 15:28:20 +01:00
Mykola Pokhylets
89f8f8b9bf Wrap only changes related to the closure frontend logic 2025-08-02 20:24:46 +02:00
Mykola Pokhylets
ae48446716 Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved 2025-08-02 20:24:21 +02:00