Commit Graph

25 Commits

Author SHA1 Message Date
Allan Shortlidge
590d3353e6 Frontend: Introduce an alias for the IsolatedAny experimental feature.
To preserve compatibility with older compilers that do not allow `IsolatedAny`
to be enabled in production compilers, use an alias experimental feature when
building the stdlib (`IsolatedAny2`).

Also, add `@_allowFeatureSuppression(IsolatedAny)` in a couple spots it was
forgotten.

Partially resolves rdar://125138945
2024-03-27 22:20:50 -07:00
Allan Shortlidge
ee73ff7737 AST: Adjust declaration printing when NoncopyableGenerics2 is suppressed.
When printing declarations with `NoncopyableGenerics2` suppressed we must avoid
printing the `@_preInverseGenerics` attribute and any `borrowing` or
`consuming` parameter ownership modifiers.
2024-03-27 22:20:49 -07:00
Allan Shortlidge
2813fbe309 Frontend: Introduce an alias for the NoncopyableGenerics experimental feature.
The `.swiftinterface` of the standard library must remain compatible with some
older compilers. Unfortunately, some of those older compilers do not allow the
experimental feature `NoncopyableGenerics` to be enabled in production. To
allow the stdlib to build with non-copyable generics enabled and still have the
older compilers consume its interface, we have to use a new experimental
feature identifier that they do not know about.

Partially resolves rdar://125138945
2024-03-27 22:20:25 -07:00
Allan Shortlidge
b249503a2b AST: Introduce @_disallowFeatureSuppression attribute.
This attribute is the inverse of the existing `@_allowFeatureSuppression`
attribute.

Part of rdar://125138945
2024-03-26 17:27:57 -07:00
Sima Nerush
f1bb9c845e Merge pull request #72473 from simanerush/nonisolated-property-struct-inference
[Concurrency] Infer `nonisolated` for a mutable storage of a value type accessed from within the module.
2024-03-25 09:36:36 -07:00
Sima Nerush
05859b442c [Features] Gate global-actor-isolated types usability changes behind an experimental feature flag. 2024-03-23 20:03:01 -07:00
Kavon Farvardin
76c6510519 Merge pull request #72276 from kavon/ncgenerics-xfails-3 2024-03-16 04:18:35 -07:00
Ellie Shin
8a4137ac6c Merge pull request #72342 from apple/elsh/add-features
Map package optimization flags to features
2024-03-15 20:20:39 -07:00
Doug Gregor
164ae687ff Make NoncopyableGenerics a suppressible feature
Emit Swift interface files that are compatible with Swift compilers that
predate the introduction of noncopyable generics.
2024-03-15 14:50:40 -07:00
Ellie Shin
951e2abdea Create features mapped to package optimization flags to
allow a more standard way to pass experimental features
from build systems. Also moved other flags relevant to
diagnostics from Frontend options to Lang options.

Ref: rdar://124648653
2024-03-15 14:18:33 -07:00
Kavon Farvardin
2d065bb03b Features: Sendable doesn't use NoncopyableGenerics 2024-03-14 23:10:44 -07:00
Sophia Poirier
95abb73e1a Merge pull request #72175 from sophiapoirier/explicitly-nonisolated-closure
[Concurrency] explicit nonisolated specification for closures
2024-03-14 17:17:00 -07:00
Sophia Poirier
5ce7be7e75 [Concurrency] explicit nonisolated specification for closures 2024-03-14 12:24:13 -07:00
Doug Gregor
5bdd4e5772 Improve @_implements for associated type witnesses
Allow `@_implements` to be expressed in an extension of the protocol in
which the associated type is defined. Use this to uncomment an
intended use of `@_implements` in `Sequence` that could be used to
replace a longstanding hack for associated type inference.

Since this change means that the standard library module interface
won't be accepted by older compilers, introduce a suppressible feature
ssociatedTypeImplements` that covers the use of `@_implements` on type
declarations. This will hide the `@_implements` attribute from older
compilers.
2024-03-11 14:28:20 -07:00
John McCall
8499640224 Merge pull request #72143 from rjmccall/builtin-create-task
Unify and simplify the task-creation builtins
2024-03-07 21:45:06 -05:00
John McCall
02ddc292da Add Builtin.createTask and Builtin.createDiscardingTask. 2024-03-06 23:50:46 -05:00
Slava Pestov
b067402238 AST: Remove a usage of hasInverseMarking() 2024-03-06 22:47:54 -05:00
Slava Pestov
dcea491dbe Sema: Remove inference of conditional Copyable conformance from generic parameters 2024-03-06 22:47:54 -05:00
Allan Shortlidge
ba9b3023e0 AST: Make $UnavailableFromAsync and $NoAsyncAvailability baseline features.
They have been available since at least Swift 5.8.
2024-03-02 23:15:41 -08:00
Allan Shortlidge
d5e3e9418d AST: Make $UnsafeInheritExecutor a baseline feature.
It has been available since at least Swift 5.8.
2024-03-02 23:15:41 -08:00
Allan Shortlidge
969efc8413 AST: Add several language features to the baseline feature set.
This allows us to remove their explicit `UNINTERESTING_FEATURE` entries for
them FeatureSet.cpp. All of these features have been present in the compiler
since at least Swift 5.8.

NFC.
2024-03-02 23:15:41 -08:00
John McCall
1437acdf22 Implement conditional feature suppression.
Our standard conception of suppressible features assumes we should
always suppress the feature if the compiler doesn't support it.
This presumes that there's no harm in suppressing the feature, and
that's a fine assumption for features that are just adding information
or suppressing new diagnostics.  Features that are semantically
relevant, maybe even ABI-breaking, are not a good fit for this,
and so instead of reprinting the decl with the feature suppressed,
we just have to hide the decl entirely.  The missing middle here
is that it's sometimes useful to be able to adopt a type change
to an existing declaration, and we'd like older compilers to be
able to use the older version of the declaration.  Making a type
change this way is, of course, only really acceptable for
@_alwaysEmitIntoClient declarations; but those represent quite a
few declarations that we'd like to be able to refine the types of.

Rather than trying to come up with heuristics based on
@_alwaysEmitIntoClient or other sources of information, this design
just requires the declaration to opt in with a new attribute,
@_allowFeatureSuppress.  When a declaration opts in to suppression
for a conditionally-suppressible feature, the printer uses the
suppression serially-print-with-downgraded-options approach;
otherwise it uses the print-only-if-feature-is-available approach.
2024-03-01 22:10:14 -05:00
Doug Gregor
6075de1b62 Add upcoming feature ImplicitOpenExistentials for SE-0352
To maintain source compatibility, SE-0352 does not open existentials
with "self-conforming" type, such as `any Error` or existentials based
on `@objc` protocols. The proposal specified that this behavior would
change in Swift 6. Implement that behavior change, which can be
enabled prior to Swift 6 with the upcoming feature
`ImplicitOpenExistentials` (as documented in SE-0362).

Fixes #70873 / rdar://120902975.
2024-03-01 11:50:39 -08:00
Allan Shortlidge
44e44889a4 AST: Simplify usesFeatureTypedThrows().
NFC.
2024-03-01 00:16:41 -08:00
Allan Shortlidge
65e8ce5425 AST: Refactor FeatureSet out into its own file.
NFC.
2024-03-01 00:16:41 -08:00