Commit Graph

306 Commits

Author SHA1 Message Date
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
Gábor Horváth
61d60eb6ad Merge pull request #83483 from Xazax-hun/turn-off-addressable
[cxx-interop] Move back addressability behind a flag
2025-08-02 07:13:17 +01:00
eeckstein
8335ce577f Merge pull request #83474 from eeckstein/fix-address-of-property-feature
rename the feature AddressOfProperty to AddressOfProperty2
2025-08-01 17:38:19 +02:00
Gabor Horvath
a97d3304b6 [cxx-interop] Move back addressability behind a flag
There was another crash found by the bootstrap build bots.

This reverts commit 37ae8a22f4, reversing
changes made to 6c8da764e2.
2025-08-01 16:24:32 +01:00
Gábor Horváth
37ae8a22f4 Merge pull request #83430 from Xazax-hun/revert-addressable-flag
Revert "[cxx-interop] Move addressable parameters in interop behind a flag"
2025-08-01 08:37:25 +01:00
Erik Eckstein
ec8dcc98ad rename the feature AddressOfProperty to AddressOfProperty2
Fixes a build problem when using a mainline compiler with a 6.2 Swift.swiftinterface file.
This was caused by mistakenly cherry-picking the `#if $AddressOfProperty` conditions in the stdlib into 6.2 without the required compiler change.
2025-08-01 08:00:51 +02:00
Allan Shortlidge
2b8ab7fbab AST: Re-baseline SendingArgsAndResults feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
a37ce9a543 AST: Re-baseline IsolatedDeinit feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
71a5d9bd74 AST: Re-baseline ValueGenericsNameLookup feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
1d9e085197 AST: Re-baseline NonescapableTypes feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
dd28a3e4b5 AST: Re-baseline IsolatedAny feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
491a43a66b AST: Re-baseline MemorySafetyAttributes feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
b8441c1c5d AST: Re-baseline ValueGenerics feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
49dcbb7ad4 AST: Re-baseline BitwiseCopyable2 feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
6dd3e49954 AST: Re-baseline BuiltinEmplaceTypedThrows feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
69c13c33c6 AST: Suppress -Wunused for allowFeatureSuppression(). 2025-07-31 10:21:55 -07:00
Gabor Horvath
254f72fdb4 Revert "[cxx-interop] Move addressable parameters in interop behind a flag"
This reverts commit f270e36aa5.
2025-07-30 15:24:45 +01:00
Gabor Horvath
f270e36aa5 [cxx-interop] Move addressable parameters in interop behind a flag
This unblocks the CI while we figure out some SILGen issues. We cannot
reuse AddressableParameters because that is already used in some
projects and consuming modules where the AddressableParameters flag was not
propagated to results in deserialization errors.
2025-07-28 23:29:22 +01:00
Doug Gregor
436e965b66 [SE-0466] Under main actor default isolation, explicit nonisolated is not special
Given an explicitly-nonisolated type such as

    nonisolated struct S { }

all extensions of S were also being treated as nonisolated. This meant
that being implicitly nonisolated (i.e., when you're using nonisolated
default isolation) was different from explicitly-writing nonisolated,
which is unfortunate and confusing. Align the rules, such that an
extension of S will get default isolation:

    extension S {
      func f() { } // @MainActor if we're in main actor default isolation
    }
2025-07-25 09:46:34 -07:00
Doug Gregor
5023b90f93 Merge pull request #82921 from DougGregor/sendable-prohibits-mainactor-by-default
[SE-0466] Enable SendableProhibitsMainActorInference by default
2025-07-23 16:21:37 -07:00