Commit Graph

1116 Commits

Author SHA1 Message Date
Kavon Farvardin
30983530b6 NCGenerics: introduce SuppressedAssociatedTypes
The model for associated types hasn't been fully worked-out for
noncopyable generics, but there is some support already that is being
used by the stdlib for an internal-only (and rather cursed) protocol
`_Pointer` to support `UnsafePointer`, etc.

This patch gates the existing experimental support for associated types
behind a feature flag. This flag doesn't emit feature-guards in
interfaces, since support for it is tied closely to NoncopyableGenerics
and has been there from its early days.
2024-04-02 16:53:36 -07:00
Kavon Farvardin
554fa49a1f Test: clean-up noncopyable_generics lit usage
There no longer is a lit feature called `noncopyable_generics`, it's
just always on now.
2024-04-01 12:28:08 -07:00
Allan Shortlidge
12fccfc4e0 Frontend: Really allow any experimental feature when compiling a module interface.
The fix for https://github.com/apple/swift/pull/72632 was not sufficient
because when modules are built from textual interface that happens in a
sub-invocation which does not have typecheck-from-interface or
compile-from-interface requested action. Instead of checking a requested
action, set a language option to control whether non-production experimental
features are allowed.

Resolves rdar://125561443
2024-03-28 14:48:15 -07:00
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
37034282a1 stdlib: Adopt @_disallowFeatureSuppression(NoncopyableGenerics).
This prevents some re-declaration errors when building the standard library
from its `.swiftinterface` with older compilers.
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
b11b64273b Frontend: Allow any experimental feature to be enabled when compiling a module.
When building a module from its interface, do not diagnose whether or not a
feature is available in production compilers. This is important since older
compilers may be expected to build .swiftinterfaces that were produced by newer
compilers where the feature has been enabled by default.

Resolves rdar://125500318
2024-03-27 11:43:48 -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
Meghana Gupta
b5ca933002 Update lifetime dependence syntax and inference as per changes in the pitch
Pitch - https://github.com/apple/swift-evolution/pull/2305

Changes highlights:

dependsOn(paramName) and dependsOn(scoped argName) syntax

dependsOn(paramName) -> copy lifetime dependence for all parameters/self except
                         when we have Escapable parameters/self, we assign scope
                         lifetime dependence.

Allow lifetime dependence on parameters without ownership modifier.

Always infer copy lifetime dependence except when we have
Escapable parameters/self, we infer scope lifetime dependence.

Allow lifetime dependence inference on parameters without ownership modifier.
2024-03-23 18:19:47 -07:00
Alex Hoppen
4b423020e0 Merge pull request #72357 from ahoppen/ahoppen/no-disable-experimental-parser-round-trip
[Parser] Remove remaining `-disable-experimental-parser-round-trip` uses in test cases
2024-03-22 08:22:26 +01:00
Steven Wu
f71cce15cb [ScanDependency] Set context hash for source module
Set context hash for source module so swift-driver can use the hash to
compute output path if needed.

rdar://119202702
2024-03-20 10:12:17 -07:00
Karoy Lorentey
bd39c35026 [test] Un-xfail tests that are passing now that NoncopyableGenerics is a suppressible feature 2024-03-18 12:32:33 -07:00
Karoy Lorentey
68a8c41e81 [test] Temporarily XFAIL tests that expect swiftinterface files to work when using Optional and other stdlib features 2024-03-18 11:09:08 -07:00
Doug Gregor
7b1f41bcf2 Merge pull request #72362 from DougGregor/suppressible-noncopyable-generics
Make NoncopyableGenerics a suppressible feature
2024-03-15 18:05:28 -07:00
John McCall
cbf421924c Merge pull request #72347 from rjmccall/isolated-any-implies-sendable
Make `@isolated(any)` imply `@Sendable`
2024-03-15 18:49:32 -04: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
Alex Hoppen
978145c61d [Parser] Remove remaining -disable-experimental-parser-round-trip uses in test cases
All the features in these test cases are now supported by the new parser, so we don’t need the opt-out anymore.

rdar://124646502
2024-03-15 12:30:40 -07:00
John McCall
590643ce5e Make @isolated(any) imply @Sendable. No avoidance mechanism for now. 2024-03-15 00:40:54 -04:00
Alexis Laferrière
3703751eae Tests: remove -experimental-spi-imports from access-level on imports test 2024-03-14 07:17:23 -07:00
Mishal Shah
1a63c3abc2 Merge pull request #65629 from edymtt/edymtt/no-arm64e-fallback-test-on-apple-silicon
Configure `ModuleInterface/arm64e-fallback` to not run in simulators
2024-03-13 23:08:27 -07:00
Ellie Shin
378884eac6 Merge pull request #72282 from apple/elsh/pkg-import-pkg-interface
Fixes package import stmt missing from .package.swiftinterface.
2024-03-13 19:35:20 -07:00
Ellie Shin
2d9042386c Fixes package import stmt missing from .package.swiftinterface.
Resolves rdar://124309585
2024-03-13 14:35:57 -07:00
Ellie Shin
bb57e4b8dd Merge pull request #71944 from apple/es-interface-client
Add back a client side test loading a package interface
2024-03-12 17:04:04 -07:00
Alexis Laferrière
c13a4c57ee Merge pull request #71617 from xymus/swiftinterface-by-default-mode
ModuleInterface: Setup logic to load distributed swiftinterfaces over swiftmodules by default
2024-03-12 07:52:15 -07:00
Ellie Shin
00938a4ea5 Add back a client side test that loads a package interface 2024-03-12 01:39:50 -07:00
Doug Gregor
e0df6e01bd Merge pull request #72234 from DougGregor/attr-implements-assoc-failure-type
[Associated type inference] Support `@_implements` on type witnesses and use it for async sequence `Failure`
2024-03-11 21:03:54 -07:00
Konrad `ktoso` Malawski
7d7673b47a [Distributed] simplify version match in test (#72242) 2024-03-11 18:52:15 -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
Doug Gregor
a06e3c8d5d Add a test where the same type is both and async sequence and its iterator 2024-03-11 13:16:14 -07:00
Doug Gregor
b944be20dd Renamed type witnesses for the Async(Sequence|IteratorProtocol) Failure type
The type aliases for inferred type witnesses to the AsyncSequence and
AsyncIteratorProtocol's Failure associated type are getting in the way
of existing types with the same name. Therefore, when we create these
type aliases, given them weird names (e.g., `__AsyncSequence.Failure`) and
wire them up with `@_implements(<protocol>, Failure)` so that
associated type inference will find them.

This is probably a model we should move to in general, because it's odd
that we inject new declarations into types that could cause conflicts.
However, start by staging it in for just this one associated type
where we have source-compatibility concerns, and we can expand it over
time.

Fixes rdar://124362873.
2024-03-11 12:49:25 -07:00
Pavel Yaskevich
6e4b10af23 [Tests] Distributed: conditionalize deinit check 2024-03-08 09:52:39 -08:00
Konrad `ktoso` Malawski
3f1ccd0fd5 Improve test to confirm round-trip compilation from module or swiftinterface 2024-03-08 21:23:00 +09:00
Konrad `ktoso` Malawski
573ad768f6 [Distributed] Add ModuleInterface test with generic distributed actor 2024-03-08 15:58:08 +09:00
Slava Pestov
af8c8f1671 Sema: Remove non-experimental associated type inference 2024-03-07 17:30:17 -05:00
Slava Pestov
d3028604c7 Merge pull request #72112 from slavapestov/ncgenerics-fixes-8
Non-copyable generics fixes, part 8
2024-03-07 07:34:45 -05:00
Pavel Yaskevich
d66eeae5ed Merge pull request #72107 from xedin/rework-getting-types-from-system
[AST/Sema] Distributed: Refactor type and member queries
2024-03-07 00:14:53 -08:00
Slava Pestov
dcea491dbe Sema: Remove inference of conditional Copyable conformance from generic parameters 2024-03-06 22:47:54 -05:00
Kavon Farvardin
777e3d945f NCGenerics: @_preInverseGenerics across modules 2024-03-06 14:56:07 -08:00
Pavel Yaskevich
9dec6927de [Tests] Distributed: Fix interface printing test to expect properly resolved ActorID 2024-03-06 13:51:14 -08:00
Kavon Farvardin
108fd05619 flesh out more of Swiftskell test 2024-03-05 21:50:19 -08:00
Allan Shortlidge
c9a737b370 AST: Don't drop inferred available attributes containing just unavailable.
Fixes a regression from https://github.com/apple/swift/pull/71922.

Resolves rdar://124073829
2024-03-05 13:24:31 -08: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
bb416e12cf ModuleInterface: Use --implicit-check-not in features.swift test. 2024-03-02 23:15:41 -08:00
John McCall
fc538f32fb Allow declarations to opt in to suppressing @isolated(any). 2024-03-01 22:10:15 -05:00
Holly Borla
9ba481ad53 [Diagnostics] Clarify the wording of error_in_future_swift_version. 2024-03-01 12:05:51 -08:00
Doug Gregor
13bebd27ad Merge pull request #71990 from DougGregor/new-concurrency-lib-old-compiler-hacks
Introduce suppressible features so that the newer _Concurrency interface file can be handled by older compilers
2024-02-29 16:10:37 -08:00
Doug Gregor
c96a89b2f2 Introduce a suppressible feature for async sequences Failure type
Suppressing this feature doesn't disable the use of new syntax in the
normal way. Instead, it introduces `@rethrows` on the
AsyncIteratorProtocol and AsyncSequence protocols, so that older
compilers can still use the async sequences generated by newer
compilers and standard libraries.

Fixes the rest of rdar://123782658
2024-02-29 11:49:26 -08:00
Doug Gregor
d1ac903be4 Introduce a suppressible feature for availability on associated types
This allows us to emit Swift interfaces that can be handled by older
Swift compilers.
2024-02-29 10:09:08 -08:00
Doug Gregor
b2b22e7a9c Merge pull request #71957 from DougGregor/failure-assoc-type-seq
Always infer AsyncSequence.Failure from AsyncIteratorProtocol.Failure
2024-02-28 16:49:57 -08:00