Commit Graph

1088 Commits

Author SHA1 Message Date
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
Meghana Gupta
a79facf02b Fix ASTPrinting of lifetime dependence
This fixes the errors while compiling functions with lifetime dependence
in the textual interface files.

Also fixes rdar://122573346
2024-02-23 15:35:37 -08:00
Meghana Gupta
ca73cba046 Enable lifetime dependence inference when NonescapableTypes is on 2024-02-23 01:49:47 -08:00
Kavon Farvardin
c50cd2e48c Merge pull request #71794 from kavon/ncgenerics-test-fixes-kavon-v19
NCGenerics: conformances can depend on Copyable
2024-02-22 12:40:42 -08:00
Mishal Shah
cb96ec2893 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-22 09:44:44 -08:00
Kavon Farvardin
19933d0a00 NFC: move Swiftskell to shared test/Inputs directory 2024-02-21 22:38:23 -08:00
Allan Shortlidge
1b7d8b6eda ModuleInterface: Improve TypedThrows feature guards.
Functions that use typed throws _anywhere_ in their signature (including in
closure types) need to be surrounded with `if $TypedThrows` guards in
swiftinterfaces.
2024-02-21 17:59:49 -08:00
Ellie Shin
edc5aba318 Re-enable package interface test.
Previously package decls at the defition sites were non-resilient.
Now they are resilient by default and are printed in interface as so.

Ref: rdar://118461385
2024-02-21 16:28:19 -08:00
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00
Mishal Shah
b488702cc9 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 21:04:47 -08:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Holly Borla
f8094061ad Merge pull request #71727 from hborla/double-preconcurrency
[Concurrency] Don't add redundant implicit `@preconcurrency` attributes.
2024-02-20 07:27:39 -08:00
Kavon Farvardin
722282ee4f ASTPrinter: fix nested inverse printing
Nested types with inverse requirements on generic parameters would
sometimes print incorrectly. We only print the inverses on outer generic
parameters for extensions.

fixes rdar://123281976
2024-02-19 23:50:15 -08:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Holly Borla
b609d804da [Concurrency] Don't add redundant implicit @preconcurrency attributes to
declarations with an explicit annotation.
2024-02-19 11:09:36 -08:00
Doug Gregor
e3c2162be2 Cope with change to default diagnostic style 2024-02-19 02:48:36 -10:00
John McCall
668297e977 Don't print conformance attributes redundantly in -preserve-types-as-written.
Since we no longer remove these attributes from the AttributedTypeRepr,
if we print based on the TypeRepr, we'll print them twice.  The best
solution is to only print the attributes based on the inheritance clause
if we're not printing the type based on the TypeRepr.

Fixes rdar://122965951.
2024-02-16 15:12:24 -05:00
Kavon Farvardin
08b71e0136 NCGenerics: rebuild stdlib from its interface
When a NoncopyableGenericsMismatch happens between the compiler and
stdlib, allow the compiler to rebuild the stdlib from its interface
instead of exiting with an error.
2024-02-15 18:08:54 -08:00
Doug Gregor
3ecbfcf885 Merge pull request #71637 from apple/ApolloZhu/SE-0422/accepted 2024-02-15 03:57:05 -08:00
Doug Gregor
63c8fe3e4d Clean up formatting in test cases 2024-02-14 21:53:54 -08:00
Doug Gregor
bae1026b77 Stop emitting conditions for Swift 5.5-era features into textual interfaces
The "#if compiler(>=5.3) && $AsyncAwait" checks were necessary for
staging in concurrency in Swift 5.5. At this point, it's safe to assume
that any compiler that tries to read a generated Swift interface file will
support concurrency, so we can stop emitting these guards.
2024-02-14 21:51:55 -08:00
Apollo Zhu
9ccfb574fd Enable SE-0422 Expression macro as caller-side default argument 2024-02-14 19:22:35 -08:00