Commit Graph

349 Commits

Author SHA1 Message Date
Artem Chikin a7bbffd953 Merge pull request #88205 from artemcm/DiagnoseAttr
[Source Warning Control] Rename `@warn` to `@diagnose` & prevent printing it in Textual Interfaces
2026-05-07 16:52:22 +01:00
Xi Ge 6112096f0e [Sema] Add experimental feature flag to allow internal bridging header types in stored property layout
In non-resilient modules, stored properties are implicitly exported for layout purposes, preventing the use of types from an internal
bridging header. This adds the AbstractStoredPropertyLayout experimental feature flag that suppresses the exportability diagnostic
specifically for layout-contributing stored properties (ImplicitlyPublicVarDecl and ImplicitlyPublicVarDeclOpenClass), enabling a
public struct to contain private stored properties of C types imported via -internal-import-bridging-header.

This is the first step toward encoding abstract layout information in the .swiftmodule so that clients can allocate, copy, and
destroy values without loading the internal C dependency.
2026-05-05 10:28:20 -07:00
Alejandro Alonso b87c07a487 Rename Borrow and Inout to Ref and MutableRef 2026-05-01 16:54:42 -07:00
Artem Chikin 00001b93e4 [Source Warning Control] Exclude @diagnose from textual module interfaces
The @diagnose attribute only affects local diagnostic behavior within a declaration's body and has no API or ABI impact. It should not appear in .swiftinterface files, and should not cause declarations to be wrapped in #if $SourceWarningControl feature guards.
2026-04-29 10:39:29 +01:00
Artem Chikin 866371d73e [Source Warning Control] Rename '@warn' to '@diagnose'
Resolves rdar://173774670
2026-04-29 10:39:25 +01:00
Konrad Malawski 4e4769de49 Rename stale CallerIsolated to NonisolatedNonsending 2026-04-28 09:21:23 -07:00
Konrad Malawski 3beefe5bd8 Rename CallerIsolationInheriting -> NonisolatedNonsending 2026-04-28 09:21:23 -07:00
Doug Gregor aad51cab01 [Embedded] Remove the ability to disable existentials in Embedded Swift
Support for existentials in Embedded Swift has been available for a
little while now and appears to be solid. Remove the ability to disable
them (via `-disable-experimental-feature EmbeddedExistentials`), both
because it simplifies the code and because it's an ABI break to
disable the feature.
2026-04-17 17:38:01 -07:00
Kavon Farvardin e2f90d36b3 Merge pull request #88350 from kavon/reparenting-feature-guarding
Reparenting: improve interface feature guarding
2026-04-10 08:24:49 -07:00
Kavon Farvardin aca6d33542 Reparenting: be more defensive in feature guarding
Wouldn't expect it to be the case, but I guess Types
in the AST can be invalid when emitting an interface.
2026-04-09 08:40:49 -07:00
Kavon Farvardin f608fc03ef Reparenting: even more feature guarding improvements
The only known condfail scenario is inheriting from
a protocol P that inherits from a reparentable one R.

We already guard P if it mentions R in its inheritance clause.
So older compilers will simply report that "P" is missing in the
interface, which is a better error message than virally guarding
everything mentioning P. It's an ABI break anyway to do that
without introducing a `@reparented` extension, which needs a guard.

In theory, older compilers shouldn't have too much go wrong if they
were to ignore `@reparentable`, though the RequirementMachine and
witness tables will look different.

rdar://174263176
2026-04-08 10:48:40 -07:00
Kavon Farvardin 82bb7a76bd Reparenting: improve interface feature guarding
This should avoid a condfail when using an older compiler on the newer stdlib that contains the `@reparentable` BorrowingSequence.

rdar://174263176
2026-04-07 19:00:06 -07:00
Alejandro Alonso b6bf06e97e Guard Borrow and Inout definitions 2026-04-01 15:45:28 -07:00
Konrad Malawski 9aeeb328ed [Concurrency] guard cancel shields vs unsuported SDKs
Otherwise we can emit those funcs into clients whose SDK doesn't know
about the builtins and fail compilation with module 'Builtin' has no member named 'taskCancellationShieldPush'

resolves rdar://173170400
2026-03-25 14:51:25 +09:00
John McCall 0b6a4e21ff Add properly paired builtins for pushing and popping task-local values
I can't quite enable modeling their stack effects in this patch because
SILGen generates improperly-nested allocations; that'll be fixed in a
follow-up.
2026-03-20 00:21:40 -04:00
Susana Monteiro 7a3ba1e6b7 Merge pull request #87882 from susmonteiro/susmonteiro/guard-swift-stdlib-version
[cxx-interop] Gate CxxBorrowingSequence behind Swift version check
2026-03-17 14:21:46 +00:00
susmonteiro e66793fcee [cxx-interop] Gate CxxBorrowingSequence behind Swift version check 2026-03-16 17:04:31 +00:00
Dario Rexin b595e463d4 Merge pull request #87663 from drexin/wip-typed-allocation-embedded
[IRGen] Add typed allocations for embedded Swift
2026-03-16 08:51:57 -07:00
Kavon Farvardin e5b2ead0d7 Sema: remove SE427NoInferenceOnExtension
The feature was added only to avoid a reverse-condfail
in the initial bring-up of noncopyable generics.

Nearly 2 years have passed since the last time I tried
to remove this old technical debt [1] and had to revert
it due to outdated build bots [2]. Hoping that won't be
a problem this time.

[1] 5b2f2cbfcf
[2] https://github.com/swiftlang/swift/pull/75267

resolves rdar://131560183
2026-03-11 09:57:47 -07:00
Dario Rexin 5b0da23150 [IRGen] Add typed allocations for embedded Swift
rdar://158239258

This change adds logic in the compiler to compute malloc type ids and emit them together with typed allocation calls. It also adds the new runtime function swift_allocObjectTyped, which calls typed malloc.
2026-03-05 12:41:16 -08:00
Allan Shortlidge 9724348f86 AST: Allow anyAppleOS availability without an experimental feature.
Resolves rdar://170988964.
2026-03-02 14:05:39 -08:00
susmonteiro 933903aae7 [cxx-interop] Gate CxxBorrowingSequence in swiftinterface behind 2026-02-27 18:24:01 +00:00
Nate Cook 5b082c5768 Add BorrowingSequence experimental feature flag (#87542)
This gates the ability to use the BorrowingSequence protocol's name (and
the names of the related types) behind a feature flag.

Landing this separately from #87483.
2026-02-26 23:11:30 -06:00
Erik Eckstein 0ae20ed07b SILGen: add Builtin.markDependence
It directly translates to the `mark_dependence` SIL instruction
2026-02-25 21:47:30 +01:00
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