Commit Graph

1159 Commits

Author SHA1 Message Date
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
Doug Gregor
0652bb7abe Always infer AsyncSequence.Failure from AsyncIteratorProtocol.Failure
The newly-introduced associated type `AsyncSequence.Failure` must
always be equivalent to the `Failure` type of the
`AsyncIteratorProtocol`. If the `AsyncSequence` type itself defines a
nested `Failure` type (say, for another purpose), associated type inference
would pick it and reject the `AsyncSequence`, causing a source compatibility
problem.

Work around the issue in two ways. First, always infer the type
witness for `AsyncSequence.Failure` from the type witness for
`AsyncIteratorProtocol.Failure`, so they can't be out of sync. This
means that we'll never even consider a nested `Failure` type in the
`AsyncSequence`-conforming type. This hack only applies prior to Swift 6.

Second, when we have inferred a `Failure` type and there is already
something else called `Failure` within that same nominal type, don't
print the inferred typelias into a module interface because it will
cause a conflict.

Fixes rdar://123543633.
2024-02-28 13:49:50 -08:00
Doug Gregor
ec73cf379d Fix test for tvOS, heh 2024-02-28 08:37:44 -08:00
Doug Gregor
ef7185a4a2 Don't infer empty availability attributes
Due to the mapping of iOS platform availability to tvOS platform availability,
we were ending up inferring an availability attribute `@available(tvOS)` for
an associated type, which does not parse properly. Suppress the creation
of inferred availability attributes when they convey no information
(e.g., because they have no introduced/deprecated/obsoleted/etc. in them).

Fixes rdar://123545422.
2024-02-27 11:28:31 -08:00
Alexis Laferrière
4945cfcad1 ModuleInterface: Setup logic to load swiftinterfaces by default
The Swift compiler can load either the binary swiftmodule file or the
textual swiftinterface file when importing a module. It currently picks
the swiftmodule over the swiftinterface, unless there’s an exception. We
should flip the default for distributed modules, prefer the
swiftinterface over the swiftmodule unless there’s an exception.

rdar://122955640
2024-02-27 10:26:31 -08:00
Doug Gregor
0c9c734f7e Merge pull request #71722 from DougGregor/diagnostic-style-swift-default 2024-02-24 14:42:38 -10:00
Meghana Gupta
0a2ec68270 Merge pull request #71856 from meg-gupta/fixastprinting
Fix ASTPrinting of lifetime dependence
2024-02-23 18:21:29 -08:00
Ellie Shin
efbe393fbe Merge pull request #71778 from apple/es-pkgint
Re-enable package interface test.
2024-02-23 16:41:04 -08:00