Commit Graph

187431 Commits

Author SHA1 Message Date
Kathy Gray
e25cfc6d23 Expand support for PackExpansion type in requirements maching
Types where pack expansion required nested subsitution could cause the compiler to crash rather than properly expanding the pack. Both for populated types and infinityly expanding types which should generate an error.
This expands the support for these to generate more errors and populated types, and correspondingly expands the test suite
2025-10-10 17:46:22 +01:00
Kathy Gray
ce9368c39c Diagnostics change for ambiguous overloads previously specifying 'this'
Updates the message to use the type or ValueDecl instead of saying 'this' on 'Found this candidate' messages to provide more information where possible in selecting overloads

Per comment during draft iteration uses getInterfaceType and adds removeSelfParam to ValueDecl.t

Migrate to calling interfaceType and remove SelfParam

Update tests to reflect type information in ambiguity resolution

All but 5 tests now passing. Those 5 either do not refer to overloading errors or do pass even when modified to accept type specification

Move implementation to ValueDecl now that tests largely pass
2025-10-10 17:46:22 +01:00
Kathy Gray
97dfc82255 Update tests to reflect type information in ambiguity resolution
All but 7 tests now passing. Those 7 tests either do not refer to these circumstances or do not seem to pass even when modified to accept type specifications.
2025-10-10 17:46:22 +01:00
Kathy Gray
84ef25afbc Migrate to calling interfaceType and remove SelfParam
Migrate more tests
2025-10-10 17:46:22 +01:00
Kathy Gray
3eee15f1cb Correct missed with type phrase 2025-10-10 17:46:22 +01:00
Kathy Gray
5e407bce89 Diagnostics change for ambiguous overloads previously specifying 'this'
Updates the message to use the type or ValueDecl instead of this on previous 'Found this candidate' messages
Note: doees not yet change all test cases so more tests are failing

Improve Diagnostic message on overload ambiguitiy

Remove messages that say 'found this candidate' in favour of providing the type for the candidate to aid in selection when the candidates are presented in a dialogue window.

Fix more tests
2025-10-10 17:46:22 +01:00
Eric Miotto
31536e9ee3 CMake: make the libswiftCompatibilitySpan symlink relative (#84200)
Currently we create an absolute one -- this prevents to use the partial
toolchain before the installation phase (namely for configurations that
run Swift tests on a different device than the builder).

Addresses rdar://160277259
2025-10-10 17:46:22 +01:00
Slava Pestov
f932ef4db9 SIL: Fix bug in AbstractionPattern::getFunctionThrownErrorType()
When storing a closure with type `() throws(any Error) -> ()` as
a fully opaque error, we want to leave it unchanged, instead of
re-abstracting it to throw the error indirectly. Thus, we had
a special carveout here.

However, the carveout was too broad, because if the thrown error
type contained type parameters, the resulting AbstractionPattern
was invalid.

While fixing this I realized this entire hack is unsound in some
cases, if you view the same value as a `() throws(U) -> ()` vs
an `() -> throws(any Error) -> ()`.

Perhaps we should always box the thrown error when maximally
abstracting a closure, but that would also be an ABI break.

- Fixes https://github.com/swiftlang/swift/issues/84051
2025-10-10 17:46:22 +01:00
Hamish Knight
d829d1596f [AST] NFC: Remove an unnecessary allocation
I missed this when changing the case body vars to be tail allocated,
remove the use of `AllocateCopy`.
2025-10-10 17:46:22 +01:00
Mike Ash
716f2bc0b7 [Concurrency] Emit async task running/waitingOn metadata inline into CPUTrace.
This allows tracking async code execution throughout a task's lifetime.

rdar://137230240
2025-10-10 17:46:22 +01:00
Egor Zhdan
cc23c32058 [cxx-interop] Avoid trying to instantiate copy constructor of std::optional<NonCopyable>
In libc++, `std::optional` inherits from several mixin base types. Some of those base types do not declare a deleted copy constructor for non-copyable value types, which works fine because clients are not supposed to use those base types directly from C++.

Swift, however, imports all of the transitive base types when importing a C++ type. As part of this, ClangImporter will attempt to instantiate e.g. `std::__optional_copy_assign_base<NonCopyable>`, and will fail with a hard error while doing so.

rdar://152718041
2025-10-10 17:46:22 +01:00
Gabor Horvath
4af3992bb4 [cxx-interop] Restrict the uses of anonymous types
Make sure they are excluded from the reflection metadata (although in
the future we want to make sure indirect fields are included). Make sure
the users cannot refer to the anonymous field, only its members.
2025-10-10 17:46:22 +01:00
Pavel Yaskevich
798b50b38a [Concurrency] Fix @Sendable closures not inferring nonisolated(nonsending)
If there are no explicit concurrency attributes, isolated parameters,
or captures associated with the closure it should infer `nonisolated(nonsending)`
for the parent conversion injected by the solver (this conversion is injected
because the solver cannot check captures to elide it).

The change pushes `isIsolationInferenceBoundaryClosure` check down
with added benefit of getting preconcurrency context from the parent.
2025-10-10 17:46:22 +01:00
Artem Chikin
44f16a985b [Dependency Scanning] Re-enable querying Swift Overlays only for visible Clang modules
This change re-enables the new semantic of looking up Swift Overlay modules only for "visible" clang modules.
We have investigated the failures we were seeing with this change enabled and addressed them with project-side fixes.
2025-10-10 17:46:22 +01:00
Anton Korobeynikov
3011cc6077 Correctly handle multiple semantic results for autodiff subset
differential thunks.

Fixes https://github.com/swiftlang/swift/issues/84365
2025-09-17 15:46:33 -10:00
Saleem Abdulrasool
f244c8f5b4 Merge pull request #84177 from compnerd/dependencies
build.ps1: extract third party dependency builds
2025-09-10 08:18:30 -07:00
Joe Groff
7a0ab9d9a8 Merge pull request #84190 from jckarter/formal-evaluation-scope-for-noncopyable-consuming-switch
SILGen: Add missing FormalEvaluationScope when evaluating consumed noncopyable switch subjects.
2025-09-10 08:13:34 -07:00
John McCall
e5b6a88c5e Merge pull request #84181 from rjmccall/isolation-fixes
Isolation fixes for closures and defer bodies
2025-09-10 08:39:09 -04:00
Anton Korobeynikov
7668666ad2 Support differentiation of wrapped value modify accessors (#78794)
Some fixes for coroutines with normal results and `partial_apply` of coroutines were required.

Fixes #55084
2025-09-10 02:30:26 -07:00
Yuta Saito
401b705295 Merge pull request #81348 from kateinoigakukun/yt/dyn-replace-asan
IRGen: Disable ASan for the auto dynamic replacement array
2025-09-10 17:46:04 +09:00
Hamish Knight
f8218e3254 Merge pull request #83777 from hamishknight/ext-cleanup
[Sema] Clean up extension binding a little
2025-09-10 09:37:20 +01:00
Hamish Knight
872176bdd1 Merge pull request #84149 from hamishknight/case-and-pat
A few pattern cleanups + fixes
2025-09-10 09:36:22 +01:00
nate-chandler
b740a457c3 Merge pull request #84185 from nate-chandler/rdar159211502
[SILVerifier] Ease this over-strict verification.
2025-09-09 23:47:35 -07:00
Slava Pestov
0063c3c522 Merge pull request #84131 from slavapestov/remove-covariant-result-type-post-cleanup
Sema: Clean up getTypeOfMemberReference() and buildMemberRef()
2025-09-10 01:39:38 -04:00
Allan Shortlidge
ecd2b8af61 Merge pull request #84189 from tshortli/clang-feature-avail-kind-switch
AST: Avoid covered switches over `Clang::FeatureAvailKind`
swift-DEVELOPMENT-SNAPSHOT-2025-09-10-a
2025-09-09 21:09:13 -07:00
Rintaro Ishizaki
eed4fef9bd Merge pull request #84179 from rintaro/astgen-test-stringprocessing-rdar159635602
[ASTGen/Tests] Add 'REQUIRES: string_processing'
2025-09-09 16:29:00 -07:00
Joe Groff
90182d0417 SILGen: Add missing FormalEvaluationScope when evaluating consumed noncopyable switch subjects.
After #83959, we expect noncopyable OpenExistential evaluations to have an outer
FormalEvaluationScope to forward to. However, there was no such
FormalEvaluationScope while emitting a consuming switch subject, causing an assertion
failure to trip. Add a FormalEvaluationScope tightly scoped around the evaluation in
this case, fixing rdar://160080337.
2025-09-09 16:02:57 -07:00
Slava Pestov
60246a2889 Sema: Further split up getTypeOfMemberTypeReference() 2025-09-09 18:58:10 -04:00
Slava Pestov
68be47f166 Sema: Re-organize some logic in getTypeOfMemberReference() 2025-09-09 18:58:10 -04:00
Slava Pestov
a7cbe5cc11 Sema: Remove unused variable 2025-09-09 18:58:10 -04:00
Slava Pestov
13b4b03aca Sema: Fix crash in IgnoreAssignmentDestinationType::diagnoseForAmbiguity() 2025-09-09 18:58:10 -04:00
Slava Pestov
45ec809330 Sema: Clean up property wrapper application in getTypeOfMemberReference()
If there are no property wrappers to unwrap, we don't need to take the
FunctionType apart and put it back together again.
2025-09-09 18:58:10 -04:00
Slava Pestov
6dc2e7558d Sema: Don't modify openedType in getMemberReferenceTypeFromOpenedType() 2025-09-09 18:58:09 -04:00
Slava Pestov
b6676fa38f Sema: Move ConstructorDecl hack out of getMemberReferenceTypeFromOpenedType() 2025-09-09 18:58:09 -04:00
Slava Pestov
27c52eb4a9 Sema: Clean up buildOtherConstructorRef() 2025-09-09 18:58:09 -04:00
Slava Pestov
9e2d4c520f Sema: More DynamicSelfType cleanup 2025-09-09 18:58:09 -04:00
Slava Pestov
45e3f1bc00 AST: Add TypeBase::eraseDynamicSelfType() 2025-09-09 18:58:09 -04:00
Nate Chandler
9bbfb2106b [SILVerifier] Ease this over-strict verification.
It's permitted for a `witness_method` instruction to have multiple
type-dependent operands.  This can happen when for example when one
local archetype is defined in terms of another.

rdar://159211502
2025-09-09 15:44:08 -07:00
Owen Voorhees
c849ae2727 Merge pull request #83963 from owenv/exclusivity-docs
Add documentation to static exclusivity diagnostics
2025-09-09 15:44:08 -07:00
Charles Zablit
ff62407c1b Merge pull request #84169 from charles-zablit/charles-zablit/demangling/make-printRoot-virtual
[demangling] make printRoot virtual
2025-09-09 23:37:12 +01:00
Allan Shortlidge
888ec24c03 AST: Avoid covered switches over Clang::FeatureAvailKind.
Make it possible to expand the `Clang::FeatureAvailKind` enum without breaking
the Swift compiler build.
2025-09-09 15:28:42 -07:00
Hamish Knight
d3be024a54 [IDE] Introduce ReadyForTypeCheckingCallback
This avoids the layering violation of calling `bindExtensions` from
parser code.
2025-09-09 23:18:52 +01:00
Hamish Knight
17fe3de8c7 [Sema] Clean up extension binding a little
- Turn `BindExtensionsForIDEInspectionRequest` into the main extension
binding request.
- Change `ExtendedNominalRequest` such that it's no longer what
extension binding calls into to do the name lookup, instead it calls
directly into `computeExtendedNominal`. `getExtendedNominal` can
then be the entrypoint for `ExtendedNominalRequest` and assumes that
extension binding has already run. This avoids needing to fake the
dependency relationship in the DeclChecker.
2025-09-09 23:18:52 +01:00
Hamish Knight
d9d0b2e6a3 [Sema] Make extension binding lazy for SourceLoader
This will mainly be useful once extension binding is fully
requestified, but even now it's a good idea to ensure module loading
isn't kicking name lookup.
2025-09-09 23:18:52 +01:00
Hamish Knight
92f2acaa67 [IDE] Remove redundant extension binding logic
I missed this in my previous patch that moved extension binding until
after we've mutated the AST for IDE inspection, this ad-hoc extension
binding logic is no longer necessary.
2025-09-09 23:18:52 +01:00
Egor Zhdan
5dc2817913 Merge pull request #83874 from egorzhdan/egorzhdan/redecl-context-assertion
[cxx-interop] Fix an assertion for `extern "C"` blocks
2025-09-09 23:11:39 +01:00
Hamish Knight
b420cd2319 Merge pull request #84174 from hamishknight/disable-usr-verification-for-sdk-complete
[test] Disable USR verification for a couple of SDK completion tests
2025-09-09 22:47:38 +01:00
Jakub Florek
6955bdf564 Merge pull request #84173 from MAJKFL/fix-licm-not-projecting-load-path
Fix licm not projecting load path before load splitting.
2025-09-09 22:43:53 +01:00
Joe Groff
9b271db816 Merge pull request #84143 from jckarter/protocol-objc-class-dyn-self-mismatch
SILGen: Use lowered function type parameters in objc-to-swift thunks for initializers.
2025-09-09 14:41:21 -07:00
Chris McGee
1380a3e2a9 Merge pull request #83044 from cmcgee1024/add_more_symbol_graph_opts_swiftc
Add pretty print and skip synthesized members to the frontend options
2025-09-09 15:24:27 -04:00