Commit Graph

46165 Commits

Author SHA1 Message Date
Pavel Yaskevich
65e83a8bb1 [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.
2025-06-02 23:49:52 -07:00
Doug Gregor
7472a0ca38 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:37:58 -07:00
Artem Chikin
4fb4945ab9 Merge pull request #81908 from artemcm/FixImplicitBuildCXXInteropCycle
[C++Interop] Do not query C++ Standard Library Swift overlays when building Swift modules which were built without C++ interop
2025-06-02 23:26:27 -07:00
Konrad `ktoso` Malawski
d6a1173bbf Merge branch 'main' into wip-fix-for-real-ptr-auth 2025-06-03 15:12:40 +09:00
Allan Shortlidge
f4b4dc9889 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 17:55:38 -07:00
Meghana Gupta
36f3574f9c Fix deserialization of lifetime dependencies on ast function types
While deserializing AST function types FunctionType and GenericFunctionType which include
lifetime dependencies and an implicit self parameter, we don't correctly populate
ASTExtInfoBuilder.lifetimeDependencies.  We end up reading one dependency less due to
incorrect index calculation.

Unlike SILFunctionType, AST function types FunctionType and GenericFunctionType
do not include implicit self in their param list. They represent methods with
implicit self as like: `(Self) -> (Args...) -> Result` and don't have any information
to indicate they may have implicit self. Since we use number of parameters while
deserializing lifetime dependencies, we go wrong for such function types.

Serialize the length of parameter indices, so that lifetime dependencies can be
deserialized to that length.

rdar://151768216
2025-06-02 17:29:05 -07:00
Meghana Gupta
ba678b5518 Merge pull request #81893 from meg-gupta/lifetimediagnostics
Fix diagnostic messages for some cases of invalid lifetime dependencies
2025-06-02 16:01:00 -07:00
Artem Chikin
5b501ad2c5 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:16:57 -07:00
Michael Chiu
84ee0af416 CLongDouble should map to Float128 (which is yet supported) on arm64, and trivial copy ctor is yet available even on 14 2025-06-02 13:39:50 -04:00
Michael Chiu
7bbafc599d Merge branch 'main' into mchiu/freebsd 2025-06-02 13:33:18 -04:00
Pavel Yaskevich
e1e9f04398 Merge pull request #81863 from xedin/using-for-default-isolation-in-file-context
[AST/Sema] SE-0478:  Implement `using` declaration under an experimental flag
2025-06-02 09:56:29 -07:00
susmonteiro
79227e7a09 [cxx-interop] Fix ambiguous methods in long chains of inheritance 2025-06-02 16:51:58 +01:00
Konrad 'ktoso' Malawski
2c99a669d3 Correct priority cancellation handler signing once more
Resolves rdar://150378890 for real this time, verified on arm64e myself
2025-06-02 21:32:57 +09:00
Allan Shortlidge
d5ef256b40 Merge pull request #81751 from tshortli/migratable-member-import-visibility 2025-06-01 08:49:01 -07:00
Meghana Gupta
cbe253326b Fix diagnostic messages for some cases of invalid lifetime dependencies 2025-06-01 07:55:07 -07:00
Pavel Yaskevich
21ec5924f7 [AST] NFC: Capitalize UsingSpecifier::nonisolated for consistency 2025-05-31 10:49:50 -07:00
Pavel Yaskevich
ec9132cb5a [Diagnostics] Tailor using diagnostic to current use-case - default isolation 2025-05-31 10:49:50 -07:00
Pavel Yaskevich
c246a7a372 [AST/Sema] Hide using declaration behind DefaultIsolationPerFile experimental feature 2025-05-31 10:49:50 -07:00
Pavel Yaskevich
36b77116bd [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.
2025-05-31 10:49:50 -07:00
Pavel Yaskevich
4ad27ba61e [Parse] Implement parsing for using declarations 2025-05-31 10:49:45 -07:00
Slava Pestov
f6f0d75263 Merge pull request #81843 from slavapestov/hamish-fuzzer-fixes
Hamish fuzzer fixes
2025-05-31 12:28:56 -04:00
Hamish Knight
dde37c0f01 Merge pull request #81868 from hamishknight/x-of-hearts
Change InlineArray sugar separator `x` -> `of`
2025-05-31 10:05:26 +01:00
Pavel Yaskevich
dad81fb4bc Merge pull request #81779 from xedin/diagnostic-fixes
[Diagnostics] A collection of diagnostic fixes/improvements
2025-05-30 18:37:16 -07:00
Artem Chikin
bb6967bcb9 Merge pull request #81850 from artemcm/BridgeHeaderScanDiagnostics
[Dependency Scanning] Bridge diagnostics emitted during bridging header scanning
2025-05-30 18:36:16 -07:00
Pavel Yaskevich
4b5105df5e [ASTGen] Implement bridging for using declaration 2025-05-30 15:52:09 -07:00
Allan Shortlidge
aca604660f 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-05-30 15:34:08 -07:00
Allan Shortlidge
d258fa783b AST: Simplify the interface of DiagnosticEngine::getBestAddImportFixItLoc().
For clarity, it should just take a `SourceFile`.
2025-05-30 15:34:08 -07:00
Artem Chikin
8ec341eac4 [Dependency Scanning] Bridge diagnostics emitted during bridging header scanning
Instead of simply dumping them to stderr.

Resolves rdar://151993075
2025-05-30 13:50:37 -07:00
Mike Ash
81b0c9bf1e [RemoteMirror] Strip protocol descriptor pointers when reading the conformance cache.
Protocol descriptor pointers may be signed. Mark this as a StoredSignedPointer and strip it before handing it back to clients.
2025-05-30 16:28:22 -04:00
Slava Pestov
2f6b45dc7d AST: Add an assertion to ProtocolConformanceRef::getAbstract() 2025-05-30 16:27:01 -04:00
Slava Pestov
0e1561f05a Sema: Change a couple of Identifier usages to DeclName instead 2025-05-30 14:43:48 -04:00
nate-chandler
dd75d2ed82 Merge pull request #81854 from nate-chandler/rdar152195094
[DestroyAddrHoisting] Don't destructure NE aggs.
2025-05-30 11:32:12 -07:00
Pavel Yaskevich
10186d664b [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
2025-05-30 09:52:52 -07:00
Ben Barham
b0d5e0e8f1 Merge pull request #81697 from bnbarham/use-toolchain-version
Add the distribution tag to `-print-target-info`
2025-05-30 09:51:03 -07:00
Hamish Knight
5d1f219acb Change InlineArray sugar separator x -> of 2025-05-30 13:50:22 +01:00
Pavel Yaskevich
816ea9fda6 [CodeCompletion] Implement completions in using declaration's specifier position 2025-05-30 00:39:06 -07:00
Pavel Yaskevich
aabfebec03 [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.
2025-05-30 00:39:06 -07:00
Artem Chikin
74e207b7bb Merge pull request #81713 from artemcm/ClangRemapsForDepScanQueries
[Dependency Scanning] Add ClangImporter's mandatory path remaps to dependency scanning query filesystem
2025-05-29 18:25:30 -07:00
Nate Chandler
f7ca26ce93 [NFC] SIL: This utility takes a func not a module.
In preparation to use the function in the implementation.
2025-05-29 15:36:15 -07:00
Alexis Laferrière
7d6447be20 Merge pull request #81519 from xymus/cdecl-diags
Sema: Update more diagnostics for `@cdecl` and representability in the C language
2025-05-29 13:37:29 -07:00
Artem Chikin
a9e0a58b46 [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:33:36 -07:00
Mike Ash
5382e12d60 Merge pull request #81824 from mikeash/globalactorreference-ptrauth
[Runtime] Add ptrauth attribute to TargetGlobalActorReference conformance pointer.
2025-05-29 15:57:39 -04:00
Hamish Knight
c287f53580 Merge pull request #81809 from hamishknight/range-expansion
[SourceKit] Properly handle cursor info range for macro expansions
2025-05-29 20:23:54 +01:00
Erik Eckstein
28985f4d41 Swift AST: add var EnumDecl.hasRawType 2025-05-29 08:12:17 +02:00
Mike Ash
ea785c191c [Runtime] Add ptrauth attribute to TargetGlobalActorReference conformance pointer.
When the TargetGlobalActorReference conformance is an indirect pointer, the indirect pointer is signed when ptrauth is enabled.

rdar://151945202
2025-05-28 21:06:20 -04:00
Ben Barham
3c098782b4 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).
2025-05-28 17:29:17 -07:00
michael-yuji
8738e722bd Merge branch 'main' into mchiu/freebsd 2025-05-28 14:44:11 -07:00
Mykola Pokhylets
847a7d247b Update comments 2025-05-28 21:25:37 +02:00
Arnold Schwaighofer
7ac551636b Merge pull request #81714 from aschwaighofer/se0460
SE-0460: Introduce @specialized attribute
2025-05-28 12:03:48 -07:00
Hamish Knight
f6c73cd178 [SourceKit] Properly handle cursor info range for macro expansions
Make `getOriginalLocation` work with source ranges, and adjust the
cursor info logic to map the range into the original buffer. This
fixes the case where we were using bogus range lengths for macro
expansion decls.

rdar://151411756
2025-05-28 18:51:40 +01:00