Commit Graph

45942 Commits

Author SHA1 Message Date
Pavel Yaskevich
47925188ba [Concurrency] Fix SendableMetatype conformance failures to behave like Sendable ones
No warnings with minimal checking, warnings with `strict-concurrency=complete` and
if declaration is `@preconcurrency` until next major swift version.

Resolves: rdar://151911135
Resolves: https://github.com/swiftlang/swift/issues/81739
(cherry picked from commit e326cd00930ff042ba1595e7793af9aaf0208b97)
2025-06-06 08:51:05 -07:00
Pavel Yaskevich
2a3e2d0800 Merge pull request #82037 from xedin/rdar-146027395-6.2
[6.2][Concurrency] Downgrade errors to warnings when Sendable requirement is inferred from a preconcurrency protocol
2025-06-06 08:49:20 -07:00
Pavel Yaskevich
fe2c8ef00a [Diagnostics] Use contains instead of has when non-Sendable type appears inside of a member type
(cherry picked from commit 3495c61840)
2025-06-05 14:48:20 -07:00
Artem Chikin
e37071bcd4 Add a new diagnostic group and documentation for the module-not-found failure which specifies that a missing module dependency can be found on a search path serialized in another Swift binary module dependency. 2025-06-05 10:24:56 -07:00
Artem Chikin
e67be5ad7a [Dependency Scanning] Serialized Swift binary module serialized search paths 2025-06-05 10:24:50 -07:00
Artem Chikin
5dc42ffb0c [Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module.
Unlike with implicitly-built modules (prior to Swift 6 mode), explicitly-built modules require that all search paths be specified explicitly and no longer inherit search paths serialized into discovered Swift binary modules. This behavior was never intentional and is considered a bug. This change adds a diagnostic note to a scan failure: for each binary Swift module dependency, the scanner will attempt to execute a dependency scanning query for each serialized search path inside that module. If such diagnostic query returns a result, a diagnostic will be emitted to inform the user that the dependency may be found in the search path configuration of another Swift binary module dependency, specifying which search path contains the "missing" module, and stating that such search paths are not automatically inherited by the current compilation.
2025-06-05 10:24:43 -07:00
Pavel Yaskevich
608a37ad04 Merge pull request #81997 from xedin/using-for-default-isolation-in-file-context-6.2
[6.2][AST/Sema] SE-0478: Implement using declaration under an experimental flag
2025-06-05 00:44:21 -07:00
Doug Gregor
3604f8918c Merge pull request #81985 from DougGregor/non-sendable-metatype-capture-diag-fixes-6.2
[6.2] Minor fixes for the non-sendable meta type capture diagnostics
2025-06-04 17:59:17 -07:00
Pavel Yaskevich
e5501d485a [AST] NFC: Capitalize UsingSpecifier::nonisolated for consistency
(cherry picked from commit 21ec5924f7)
2025-06-04 13:22:34 -07:00
Pavel Yaskevich
76886eb82b [Diagnostics] Tailor using diagnostic to current use-case - default isolation
(cherry picked from commit ec9132cb5a)
2025-06-04 13:22:34 -07:00
Pavel Yaskevich
d3f8fd8fd7 [AST/Sema] Hide using declaration behind DefaultIsolationPerFile experimental feature
(cherry picked from commit c246a7a372)
2025-06-04 13:22:32 -07:00
Pavel Yaskevich
7d18588f93 [Concurrency] Add a request to retrieve default isolation of a file
The default isolation is computed based on `using` declaration
found in the file, if any.

(cherry picked from commit 36b77116bd)
2025-06-04 13:21:56 -07:00
Pavel Yaskevich
89c3b0ba41 [Parse] Implement parsing for using declarations
(cherry picked from commit 4ad27ba61e)
2025-06-04 13:16:55 -07:00
Pavel Yaskevich
8da356a1c2 [ASTGen] Implement bridging for using declaration
(cherry picked from commit 4b5105df5e)
2025-06-04 13:16:55 -07:00
Pavel Yaskevich
38ce1c230e [CodeCompletion] Implement completions in using declaration's specifier position
(cherry picked from commit 816ea9fda6)
2025-06-04 13:16:55 -07:00
Pavel Yaskevich
d057429e9a [AST] Add new declaration - using
Initially this declaration is going to be used to determine
per-file default actor isolation i.e. `using @MainActor` and
`using nonisolated` but it could be extended to support other
file-global settings in the future.

(cherry picked from commit aabfebec03)
2025-06-04 13:16:55 -07:00
nate-chandler
4225fbc5c8 Merge pull request #81959 from nate-chandler/cherrypick/release/6.2/rdar152431332
6.2: [DestroyAddrHoisting] Skip init_enum_data_addrs.
2025-06-04 10:42:21 -07:00
Doug Gregor
ed29e1fdcd Merge pull request #81934 from DougGregor/break-isolated-conformance-reference-cycle-6.2
Split conformance isolation request to eliminate a reference cycle
2025-06-04 10:26:52 -07:00
Doug Gregor
c1358c5b22 Add a diagnostic group for the diagnostic about non-Sendable metatypes.
This is a new restriction that folks are sure to run into, so provide
it with some actionable documentation. Fixes rdar://152450956.

(cherry picked from commit 9f0dda5417)
2025-06-04 09:48:38 -07:00
Pavel Yaskevich
6e9d97e273 Merge pull request #81945 from xedin/various-diagnostic-fixes-6.2
[6.2][Diagnostics] A collection of diagnostic fixes/improvements
2025-06-03 19:57:44 -07:00
Konrad `ktoso` Malawski
2e36f9139b Merge pull request #81900 from ktoso/pick-wip-fix-for-real-ptr-auth 2025-06-04 08:50:00 +09:00
Nate Chandler
5af84375f2 [MemAccessUtils] Add to strip access storage casts
The new function stripAccessAndAccessStorageCasts is analogous to the
existing function stripAccessAndIdentityCasts but differs in that the
latter uses isAccessStorageIdentityCast whereas the new function uses
isAccessStorageCast.
2025-06-03 15:54:11 -07:00
Nate Chandler
f99d542351 [MemAccessUtils] This instruction changes the type
moveonlywrapper_to_copyable_box changes the type so it's a type cast not
an identity cast.
2025-06-03 15:54:11 -07:00
Allan Shortlidge
5ee57368ae Merge pull request #81932 from tshortli/visionos-availability-remap-regression-6.2
[6.2] AST/Sema: Fix remapping of iOS availability in diagnostics for visionOS
2025-06-03 13:30:35 -07:00
Meghana Gupta
20ff6af60a Merge pull request #81917 from meg-gupta/fixdeserializationcp
[6.2] Fix deserialization of lifetime dependencies on ast function types
2025-06-03 10:51:57 -07:00
Pavel Yaskevich
143931ac08 [CSSimplify] Increase impact of a generic argument mismatch if mismatch is contextual
If generic arguments mismatch ends up being recorded on the result
of the chain or `try` expression it means that there is a contextual
conversion mismatch.

For optional conversions the solver currently generates a disjunction
with two choices - bind and optional-to-optional conversion which is
anchored on the contextual expression. If we can get a fix recorded
there that would result in a better diagnostic. It's only possible
for optional-to-optional choice because it doesn't bind the
variable immediately, so we need to downgrade direct fixes to prevent
`bind` choice from considered better.

(cherry picked from commit 65e83a8bb1)
2025-06-03 09:33:13 -07:00
Pavel Yaskevich
0f1cce3d4f [Diagnostics] Assign missing member eagerly when there is no context
Without contextual information it won't be possible to bind a missing
member to a concrete type later, so let's bind them eagerly and propagate
placeholders outward.

Resolves: rdar://152021264
Resolves: https://github.com/swiftlang/swift/issues/81770
(cherry picked from commit 10186d664b)
2025-06-03 09:33:13 -07:00
Meghana Gupta
3688f5f358 Merge pull request #81916 from meg-gupta/fixdiagnosticscp
[6.2] Fix diagnostic messages for some cases of invalid lifetime depenndencies
2025-06-03 05:45:59 -07:00
Artem Chikin
784a506374 Merge pull request #81912 from artemcm/FixImplicitBuildCXXInteropCycle_62
[6.2 🍒][C++Interop] Do not query C++ Standard Library Swift overlays when building Swift modules which were built without C++ interop
2025-06-02 23:59:38 -07:00
Doug Gregor
a3dd168435 Split conformance isolation request to eliminate a reference cycle
Inference of conformance isolation needs to check whether all of the
witnesses are nonisolated. However, witness checking looks at
conformance isolation. To break this reference cycle, split the
conformance isolation request into two requests: a "raw" request that
looks at explicitly-specified isolation, and the existing one that
also performs inference. The existing one builds on the "raw" one, as
does a separate path for the conformance checker.

Fixes rdar://152461344.
2025-06-02 23:43:29 -07:00
Allan Shortlidge
5b79f61414 AST/Sema: Fix remapping of iOS availability in diagnostics for visionOS.
When compiling for visionOS, iOS availability attributes are remapped into the
visionOS availability domain automatically. While the version remapping was
being performed correctly, there was a regression that caused the platform name
to be printed incorrectly in many diagnostics. Whenever an iOS version is
remapped to a visionOS version, availability diagnostics will now present
those versions as visionOS versions instead of iOS versions.

Resolves rdar://146293165.
2025-06-02 22:56:47 -07:00
Meghana Gupta
637f8ef03e [6.2] Fix deserialization of lifetime dependencies on ast function types 2025-06-02 17:36:22 -07:00
Artem Chikin
cf36c4419e Merge pull request #81876 from artemcm/BridgeHeaderScanDiagnostics_62
[6.2 🍒][Dependency Scanning] Bridge diagnostics emitted during bridging header scanning
2025-06-02 16:51:26 -07:00
Meghana Gupta
ea35d41f2a [6.2] Fix diagnostic messages for some cases of invalid lifetime dependencies
The diagnostic messages were misleading and suggested an invalid alternative.

rdar://151810577
2025-06-02 16:04:13 -07:00
Artem Chikin
5749ef3c14 Hard-code the 'Darwin' module as having been built without C++ interop
Textual interfaces for 'Darwin' built with recent compilers specify that it is built witout C++ interop enabled. However, to ensure compatibility with versions of the 'Darwin' module built with older compilers, we hard-code this fact. This is required to break the module cycle that occurs when building the 'Darwin' module with C++ interop enabled, where the underlying 'Darwin' clang module depends on C++ standard library for which the compiler brings in the 'CxxStdlib' Swift overlay, which depends on 'Darwin'.
2025-06-02 14:17:53 -07:00
Allan Shortlidge
c99b19e450 AST/Sema: Make MemberImportVisibility a migratable feature.
The migration to `MemberImportVisibility` can be performed mechanically by
adding missing import declarations, so offer automatic migration for the
feature.

Resolves rdar://151931597.
2025-06-02 07:27:41 -07:00
Allan Shortlidge
f6124cbe13 AST: Simplify the interface of DiagnosticEngine::getBestAddImportFixItLoc().
For clarity, it should just take a `SourceFile`.
2025-06-02 07:27:33 -07:00
Konrad 'ktoso' Malawski
e18f553eab Correct priority cancellation handler signing once more
Resolves rdar://150378890 for real this time, verified on arm64e myself
2025-06-02 21:40:18 +09:00
Hamish Knight
38744ebd2f Merge pull request #81877 from hamishknight/x-of-hearts-6.2
[6.2] Change InlineArray sugar separator `x` -> `of`
2025-05-31 23:50:05 +01:00
Mishal Shah
76eac9b0e7 Merge pull request #81873 from bnbarham/cherry-use-toolchain-version
[6.2] Add the distribution tag to `-print-target-info`
2025-05-30 23:50:51 -07:00
nate-chandler
57651963f1 Merge pull request #81875 from nate-chandler/cherrypick/release/6.2/rdar152195094
6.2: [DestroyAddrHoisting] Don't destructure NE aggs.
2025-05-30 21:06:59 -07:00
Hamish Knight
f1c37f4e7d Change InlineArray sugar separator x -> of 2025-05-30 22:06:29 +01:00
Holly Borla
0a3e134c20 Merge pull request #81498 from nickolas-pohilets/mpokhylets/fix-80992-6.2
6.2: Fixed no copying IsIsolated flag when cloning subscript params
2025-05-30 13:57:40 -07:00
Artem Chikin
f24016f197 [Dependency Scanning] Bridge diagnostics emitted during bridging header scanning
Instead of simply dumping them to stderr.

Resolves rdar://151993075
2025-05-30 13:53:07 -07:00
Artem Chikin
34f22c6408 Merge pull request #81848 from artemcm/ClangRemapsForDepScanQueries_62
[6.2][Dependency Scanning] Add `ClangImporter`'s mandatory path remaps to dependency scanning query filesystem
2025-05-30 13:41:04 -07:00
Nate Chandler
c894bdffab [NFC] SIL: This utility takes a func not a module.
In preparation to use the function in the implementation.
2025-05-30 13:27:45 -07:00
Ben Barham
1f53e700fa Add the distribution tag to -print-target-info
Ideally this would also update the `--version` output to be overridden
by `SWIFT_TOOLCHAIN_VERSION`, but unfortunately various tools rely on
the current format (eg. swift-build).

(cherry picked from commit 3c098782b4)
2025-05-30 10:04:40 -07:00
Hamish Knight
fbd2b8d411 Merge pull request #81845 from hamishknight/range-expansion-6.2
[6.2] [SourceKit] Properly handle cursor info range for macro expansions
2025-05-30 10:57:46 +01:00
Doug Gregor
0ed5cff7cc Merge pull request #81744 from DougGregor/more-migratable-features-6.2
[6.2] Make `InferIsolatedConformances` and `StrictMemorySafety` migratable features
2025-05-30 00:52:37 -07:00
Artem Chikin
ca59242429 [Dependency Scanning] Add ClangImporter's mandatory path remaps to dependency scanning query filesystem
On creation, 'ClangImporter' adds overlay modulemap files for non-modular platform libraries (e.g. glibc, libstdc++), which allows Swift code to import and use those libraries.

This change adds the same filesystem overlay to dependency scanning queries by applying them to the filesystem instantiated for each depndency scanning worker. Without these overlays EBM builds cannot discover and use non-modular system libraries on non-Darwin platforms.

Resolves rdar://151780437
2025-05-29 13:35:14 -07:00