Commit Graph

229 Commits

Author SHA1 Message Date
Allan Shortlidge
fa267fefff Merge pull request #83051 from tshortli/diagnose-more-invalid-os-versions
Sema: Diagnose invalid platform versions in more places
2025-07-15 17:06:39 -07:00
Allan Shortlidge
910989c2c2 AST: Store parsed version in OriginallyDefinedInAttr instead of canonical.
Canonicalize the version on-demand instead.

NFC, part of rdar://155558161.
2025-07-14 16:04:04 -07:00
Allan Shortlidge
b4b38b21d7 Tests: Use llvm-readtapi instead of diff in TBDGen tests.
Resolves rdar://155797486.
2025-07-14 11:18:03 -07:00
Konrad 'ktoso' Malawski
1f87f60d6c Revert revert & fix distributed protocol and TBD handling
This reverts a revert that was done internally here https://stashweb.sd.apple.com/projects/DEVTOOLS/repos/swift/pull-requests/8697/overview
and corrects some issues with the reverted code while at it.

This fix is crucial to land for correctness and necessary to fix the
rdar://144568615 which had a fix submitted however that assumed that
THIS change also was present, so the fix submitted for 144568615 is
incomplete without this change as well.

This enables, and adds more TBD testing and was explicitly checked
against the GameKit reproducer project from rdar://144568615.

I will also upstream the necessary parts missing from OSS repo there so
we have alignment between all branches.
2025-06-30 11:13:05 +09:00
Anthony Latsis
2cd90bdd69 AST: Quote attributes more consistently in DiagnosticsSema.def 2025-04-22 18:23:36 +01:00
Nate Chandler
056fbc44c9 [CoroutineAccessors] Control ABI via flag. 2025-04-10 07:41:37 -07:00
Konrad `ktoso` Malawski
97be02d5b2 [Distributed] Dont emit TBD also for distributed thunks (#80526)
* [Distributed] Accessor must be available cross module in resilient mode

This is an important fix for libraries using @Resolvable in resilient
libraries. Without the fix we're missing an accessor and this will fail
some remote calls which make use of remote calls on resolvable
protocols. This would manifest as missing accessor error thrown by the
executeDistributedTarget function.

resolves rdar://148224780

* Disable test on windows since %env not supported

* [Distributed] Dont emit TBD also for distributed thunks

This resolves pedantic "all" TBD validation issues, i.e. we dont emit
unexpected records anymore - we would before as we only checked for
is_distributed but we also want to skip those for is_distributed_thunk

resolves rdar://128284016
2025-04-07 06:55:19 -07:00
Nate Chandler
35d06c325d [CoroutineAccessors] Witness and vtable dispatch.
And thunking.
2025-03-07 11:46:50 -08:00
Nate Chandler
430307a29d [CoroutineAccessors] Don't synthesize overrides.
Such storage decls don't actually have entries in the wtable.
2024-11-13 21:33:08 -08:00
Nate Chandler
73de4de8a0 [CoroutineAccessors] TBDify synthesized defaults. 2024-11-13 21:33:08 -08:00
Allan Shortlidge
74035acecd SIL: Skip visiting bad extensions in SILSymbolVisitor.
When lazy typechecking is enabled, extensions that do not typecheck can make it
to TBDGen, which would crash during its AST walk because `SILSymbolVisitor`
tried to dereference the null nominal type for the extension.

Resolves rdar://139320515.
2024-11-12 17:26:48 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Allan Shortlidge
cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00
Allan Shortlidge
082f0ac4b5 Tests: Use a more natural spelling for ABI triple lit substitutions.
`%target-swift-5.8-abi-triple` instead of `%target-swift-abi-5.8-triple`, for
example.
2024-10-18 10:11:36 -07:00
Hamish Knight
b797a987a3 [test] Remove TBD output deduction test
This is only testing legacy driver behaviour. In
the new driver, only primary outputs have their
outputs deduced from the module name.
2024-09-22 19:57:21 +01:00
Erik Eckstein
c8e74b8393 Generic specialization: change the mangling for dropped metatype arguments
Instead of adding a "flag" (`m` in `...Tgm5`) make it more generic to allow to drop any unused argument.
Add all dropped arguments with a `t<n-1>` (where `<n-1>` is empty for n === 0). For example `...Ttt2g5`.
2024-08-26 10:43:15 +02:00
Konrad `ktoso` Malawski
eb675c222e [Distributed] Correct tbd handling for distributed thunks (#74935) 2024-07-26 16:52:18 +09:00
Allan Shortlidge
470baff865 Driver: Remove swift-api-extract.
Now that API descriptions are emitted during module build jobs when
`-emit-api-descriptor-path` is specified and the build system has been updated
to pass that flag when the output is needed, the `swift-api-extract` frontend
alias is no longer used. Delete it and the tests that were specific to invoking
`swift-api-extract`.

Resolves rdar://116537394.
2024-06-27 17:05:32 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Cyndy Ishida
85ea5ffc46 [TBDGen][Test] Check implied Obj-C symbol generation based on stable swift version (#72138) 2024-03-07 14:39:16 -08:00
Allan Shortlidge
f49dbb06b6 TBDGen: Specify the correct macCatalyst platform ID in $ld$previous directives.
Resolves rdar://123491072
2024-03-05 19:05:19 -08:00
Cyndy Ishida
182a27e3c2 [TBDGen][Test] Add expected failure for symbol difference on iOS (#72000)
It turns out that on iOS builds theres variance on whether `OBJC_(META)CLASS` symbols get emitted & exported. What's important for TBDGen is that it matches what gets exposed in binaries and that is still upheld on iOS.

resolves: rdar://123811306
2024-03-04 08:30:52 -08:00
Holly Borla
9ba481ad53 [Diagnostics] Clarify the wording of error_in_future_swift_version. 2024-03-01 12:05:51 -08:00
Pavel Yaskevich
cdc9a01dc1 [Tests] NFC: Adjust distributed actor test-cases changed/improved due to new requirements 2024-02-12 14:26:30 -08:00
Cyndy Ishida
f80da87839 [TBDGen] Add back standalone OBJC_METACLASS symbols (#70827)
It turns out there are valid usecases for exposing a standalone
objc-metaclass symbols and tbd files must encode it correctly.

resolves: rdar://118499886
2024-02-12 12:23:14 -08:00
Slava Pestov
0b0ad738dd AST: Record a HadError bit in DelayedConformanceDiags 2024-01-20 19:16:58 -05:00
Cyndy Ishida
1753906140 [TBDGen] Re-enable tests (#70766)
Now that Xcode has been updated on builders (https://github.com/apple/swift/issues/69485), these tests should pass.
2024-01-08 15:02:06 -08:00
Holly Borla
7cb9880b04 [Features] Gate SE-0383 behind an upcoming feature flag. 2023-11-29 07:35:37 -08:00
Cyndy Ishida
2add9c0b65 [TBDGen][Tests] Add apple vendor requirement on package test
TBD files only encode darwin based platforms. This fixes up failing linux bots.

resolves: rdar://118461540
2023-11-15 09:46:30 -08:00
Cyndy Ishida
3ccaaf529e [TBDGen] Temporarily disable tests that invoke older xcode toolchain
linker
2023-11-14 08:06:28 -08:00
Cyndy Ishida
f869bd7e8a [TBDGen] Write tbd-v5 files by default
* Fixup tests to handle new json based output.
* Use llvm-nm & readtapi to verify tbd file outputs.

resolves: rdar://117604275
2023-11-14 08:06:24 -08:00
Allan Shortlidge
1f48c59ff3 NFC: Use forbidden typechecking prefix in lazy typechecking tests.
Enhance the -experimental-lazy-typecheck suite of tests by adopting
-debug-forbid-typecheck-prefix instead of including broken code in the source
file that would cause diagnostics to be emitted if the compiler typechecks too
much during lazy typechecking. The content of .tbds and .swiftinterfaces
emitted with and without lazy typechecking enabled can now be compared since
the source compiles regardless of mode. This new test regime is less tedious to
maintain and should catch regressions more reliably since it doesn't
require new CHECK lines to be added to several tests every time a new
test case is added in the shared input file.
2023-10-30 14:50:42 -07:00
Allan Shortlidge
66abd325f9 Merge pull request #69456 from tshortli/serialization-lazy-typecheck-custom-attr
Serialization: Resolve type of CustomAttr before serializing
2023-10-27 14:29:19 -07:00
Ellie Shin
cbc050a9d8 Merge pull request #69414 from apple/es-tbd
Emit default arg for a package func during silgen
2023-10-27 12:14:24 -07:00
Allan Shortlidge
33edb6642d Serialization: Resolve type of CustomAttr before serializing.
This fixing a crash during serialization when lazy typechecking is enabled.

Resolves rdar://117442955
2023-10-26 22:46:58 -07:00
Ellie Shin
eefe516781 Update test 2023-10-26 15:18:15 -07:00
Ellie Shin
9311783616 If a package func has a default arg, its symbol is not generated
in TBD, causing a linker error. This is because the default arg
is not generated during silgen. This PR adds a check to make sure
it's represented by SILDeclRef and its linkage emitted.

Resolves rdar://116184295
2023-10-26 11:50:06 -07:00
Allan Shortlidge
f131c8a3f5 Frontend: Introduce -experimental-skip-non-exportable-decls.
Rename -experimental-serialize-external-decls only to
-experimental-skip-non-exportable-decls in preparation for the flag being used
to influence more than just serialization.

Resolves rdar://116771543
2023-10-10 16:07:04 -07:00
Allan Shortlidge
497034ef64 AST: Requestify generic signature building for @_specialized attributes.
In order to support lazy typechecking during module emission for modules
containing specialized functions, the computation of generic signatures for
`@_specialized` attributes must be requestified.

Resolves rdar://115569606
2023-09-16 00:02:33 -07:00
Allan Shortlidge
1cec6a454f Serialization: Handle precedence groups and operators in ExternallyAccessibleDeclVisitor. 2023-09-14 18:11:03 -07:00
Allan Shortlidge
061578c1a8 Serialization: Handle IfConfigDecls in ExternallyAccessibleDeclVisitor. 2023-09-14 18:09:49 -07:00
Allan Shortlidge
4522963cf7 Serialization: Handle enum cases in ExternallyAccessibleDeclVisitor. 2023-09-14 17:59:17 -07:00
Allan Shortlidge
5e76f76255 ModuleInterface: Ensure implicit accessors are created before printing.
Previously, implicit accessors would be omitted from `.swiftinterface` files
emitted with lazy typechecking enabled.
2023-09-12 09:08:10 -07:00
Allan Shortlidge
9b641f9ba3 ModuleInterface: Typecheck PatternBindingDecls lazily before printing.
Previously, fully qualified types would be missing for global vars and
properties in `.swiftinterface` files that were emitted lazily.

Adding the test case also revealed that PatternBindingDecls needed to be
typechecked before lazy module serialization as well.
2023-09-12 09:08:10 -07:00
Allan Shortlidge
67a24ccca5 TBDGen: Don't skip extensions on clang types.
Fixes a regression introduced with https://github.com/apple/swift/pull/68216.
Some nominal types belonging to clang modules don't have a clang node in the
AST, so make sure we match the logic used when computing IR linkage to
determine whether a nominal type is a clang type.

Resolves rdar://115308770
2023-09-11 16:13:03 -07:00
Allan Shortlidge
7c1b150f39 ModuleInterface: Resolve inherited types when computing unsatisfiable conformances.
Previously, unsatisfiable conformances could be omitted from emitted
`.swiftinterface` files in lazy typechecking mode since inherited types might
be unresolved when gathering the conformances.

Adding these test cases also revealed that serialization restrictions needed to
be relaxed in order to accomodate unsatisfiable conformances.
2023-09-07 13:57:39 -07:00
Allan Shortlidge
eee122c093 ModuleInterface: Resolve inherited types when recording indirect conformances.
Previously, indirect public conformances provided by conforming to an internal
protocol could be skipped in a `.swiftinterface` in lazy typechecking mode
since inherited types might not be resolved before collecting the indirect
conformances.
2023-09-07 13:57:39 -07:00
Allan Shortlidge
435f623caf AST: Resolve types when computing inherited conformances for classes.
Previously, conformances inherited through a base class could be missed in lazy
typechecking mode if types in the inheritance clause were not already resolved.
2023-09-07 13:57:39 -07:00
Allan Shortlidge
fd3714e086 AST: Resolve inherited types in usesFeatureRethrowsProtocol().
Previously, `usesFeatureRethrowsProtocol()` could mistakenly return false in
lazy typechecking mode since the types in an inheritance clause might not have
been resolved yet.
2023-09-07 13:57:39 -07:00
Allan Shortlidge
fde20160d3 TBDGen: Avoid crash when value witness is missing in conformance. 2023-09-01 08:57:33 -07:00