Commit Graph

195786 Commits

Author SHA1 Message Date
Hamish Knight
54fd18e5b5 Merge pull request #86011 from hamishknight/dyn-apply
[CS] Do member lookup last when binding dynamic member overload
2025-12-13 23:45:15 +00:00
Max Desiatov
a71c1836c7 docs/Wasm: remove incompatible --libcxx flags for build-script (#86017)
Freshly built libc++ introduces issues when building `swift-build`:

```
Undefined symbols for architecture arm64:
  "std::__1::__hash_memory(void const*, unsigned long)", referenced from:
      (anonymous namespace)::CAPIBuildDB::buildUpKeyCache(std::__1::vector<llbuild::core::KeyType, std::__1::allocator<llbuild::core::KeyType>>&) in BuildDB-C-API.cpp.o
      _llb_build_key_make in BuildKey-C-API.cpp.o
      _llb_build_key_make_command in BuildKey-C-API.cpp.o
      _llb_build_key_make_custom_task in BuildKey-C-API.cpp.o
      _llb_build_key_make_custom_task_with_data in BuildKey-C-API.cpp.o
      _llb_build_key_make_directory_contents in BuildKey-C-API.cpp.o
      _llb_build_key_make_filtered_directory_contents in BuildKey-C-API.cpp.o
      ...
ld: symbol(s) not found for architecture arm64
```

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-12-13 15:31:05 -08:00
Tim Kientzle
33e2cfa82c Merge pull request #86006 from tbkka/tbkka-float-parsing
Fix parsing issues on 32-bit hosts
2025-12-13 11:43:40 -08:00
eeckstein
80640f7f39 Merge pull request #86005 from eeckstein/fix-sil-combine
SILCombine: don't sink forwarding instructions with address operands
2025-12-13 16:50:48 +00:00
Slava Pestov
ab8ca27701 Merge pull request #86020 from slavapestov/opaque-archetype-sugar-type-variable
AST: Canonicalize opaque archetype substitution maps in the solver arena
2025-12-13 08:54:58 -05:00
Saleem Abdulrasool
e391bf55e9 Merge pull request #85960 from compnerd/plain-frontend
test: introduce swift-target-frontend-plain for CAS tests
2025-12-12 22:27:49 -08:00
Saleem Abdulrasool
3a4cd07e9a test: introduce swift-target-frontend-plain for CAS tests
This introduces a new substitution for use in the CAS tests. The plain
variant of the target frontend invokes the tool with the variant target
triple and resource dir only. This allows us to properly invoke the
frontend for the CAS tests.
2025-12-12 17:13:31 -08:00
Meghana Gupta
96cd2e1e10 Merge pull request #85987 from meg-gupta/undefcapture
Tolerate undef closure captures in ClosureLifetimeFixup
2025-12-12 16:31:09 -08:00
Slava Pestov
54521bd21b AST: Canonicalize opaque archetype substitution maps in the solver arena
Preserving sugar if we have type variables uses way too much memory.

Canonicalize these substitution maps for now, as a (temporary?) workaround.

In the future, if we decide preserving sugar is more important than a
few dozen Mb of memory usage, we can also bump the arena memory limit,
instead.

Fixes rdar://166237860.
Fixes rdar://165863647.
2025-12-12 18:11:04 -05:00
Alexis Laferrière
74c8fcfc66 Merge pull request #85990 from xymus/serial-conf-diag
Serialization: Minor improvements to the error on conformance mismatch
2025-12-12 15:05:53 -08:00
Slava Pestov
a381b1d954 Merge pull request #85968 from slavapestov/tests-12-10-2025
Add some regression tests
2025-12-12 18:05:28 -05:00
Anthony Latsis
dea291c047 Merge pull request #85971 from swiftlang/jepa-main4
SIL: Adjust pack `isa` after upstream LLVM implementation change
2025-12-12 22:20:39 +00:00
Chris McGee
a2529addef Merge pull request #85489 from johnbute/argument-parser-version-change 2025-12-12 15:07:56 -05:00
Hamish Knight
a4ae17133c Merge pull request #85973 from bnbarham/convert-async-shorthand
[SourceKit] Allow converting functions containing shorthand ifs to async
2025-12-12 17:19:23 +00:00
Pavel Yaskevich
3754042c9c Merge pull request #85964 from xedin/rdar-166244164
[Concurrency] Add `ApproachableConcurrency` as a pseudo upcoming feature flag
2025-12-12 09:01:34 -08:00
Gábor Horváth
0fcf2e1ce8 Merge pull request #85980 from Xazax-hun/recursive-enums-fix
[cxx-interop] Fix crashing on recursive enums
2025-12-12 16:45:12 +00:00
Hamish Knight
4b25dc528d [CS] Do member lookup last when binding dynamic member overload
Otherwise if the member lookup gets simplified immediately and we 
have a recursive dynamic member lookup we will crash since we wouldn't
have introduced the corresponding applicable function constraint.

rdar://164321858
2025-12-12 16:39:02 +00:00
Kathy Gray
472937e57d Merge pull request #85591 from kathygray-pl/kathy/diagnosticProperty
[Diagnostics] Increase possibility for missed property diagnostic
2025-12-12 16:09:12 +00:00
John Hui
747234cf0c Merge pull request #86002 from j-hui/migrate-incomplete-template-spec-check 2025-12-12 07:52:00 -08:00
Tim Kientzle
e75a8c03e7 Fix parsing issues on 32-bit hosts
These were mostly bugs with code of the following form:
```
  if uint64Value < (... literal expression ...)
```
Swift's comparison operators allow their left- and right-hand sides to be of
different widths.  This in turn means that the literal expression above
typically gets typechecked by default as a plain `Int` or `UInt` expression.
In a number of cases, this led to truncation on platforms where `Int` is
not 64 bits.

In particular, this seems to fix tests on wasm32.
2025-12-12 07:16:59 -08:00
Erik Eckstein
aa4e77a46c SILCombine: don't sink forwarding instructions with address operands
We don't do memory lifetime analysis for this peephole optimization.
Therefore we can't risk sinking instructions with address operands out of the addressed memory's lifetime.

For example:
```
  %3 = mark_dependence %2 on %1 : $*T  // must not be moved after the destroy_addr
  destroy_addr %1
```

Fixes a verifier crash
rdar://166240751
2025-12-12 16:11:13 +01:00
Saleem Abdulrasool
f82cf1ebfb Merge pull request #85993 from compnerd/scanning
swift-scan-test: adjust frontend detection for Windows
2025-12-12 02:25:52 -08:00
Egor Zhdan
ab275373fe Merge pull request #85979 from egorzhdan/egorzhdan/android-ptrauth
[cxx-interop] Handle missing `<ptrauth.h>`
2025-12-12 10:04:02 +00:00
Michael Gottesman
22d182552c Merge pull request #85999 from gottesmm/pr-c29e9002447c10b77a408ede1f7b7e42c5034dbf
[rbi] When looking for closure uses, handle unresolved_non_copyable_value and store_borrow temporaries.
2025-12-12 00:09:08 -08:00
Michael Gottesman
79eee82b87 Merge pull request #85997 from gottesmm/pr-10810fd33c3e8d8fd1e4072f78d63d3200d35aa7
[rbi] Remove highlights from errors.
2025-12-11 23:57:55 -08:00
Chris Williams
fe0191c62c [CSSimplify] Parameter pack wrapping logic incorrectly considers tuple LValueTypes to not be tuples (#85962)
In #65125 (and beyond) `matchTypes`, has logic to attempt to wrap an
incoming parameter in a tuple under certain conditions that might help
with type expansion.

In the case the incoming type was backed by a `var`, it would be wrapped
by an `LValueType` then be subsequently mis-diagnosed as not-a-tuple.

More details in #85924 , this this is also the cause of (and fix for)
#85837 as well...
2025-12-11 22:29:42 -08:00
Slava Pestov
ca12185204 Merge pull request #85967 from slavapestov/dont-copy-that-floppy
Sema: Avoid copying BindingSets
2025-12-12 00:18:47 -05:00
Michael Gottesman
e186e5e5d0 Merge pull request #85972 from gottesmm/pr-9663abc1697da1382a8514e6877a6c3ce3f439b9
[concurrency] Hide Concurrency StackNesting builtins behind a feature flag
2025-12-11 21:16:37 -08:00
John Hui
bb5bb97958 [cxx-interop] Move incomplete template specialization check
We were only previously doing this check when we had a typedef,
because that is the scenario where we encountered this issue.

This patch moves the check closer to where we would actually instantiate
the template, so that these cases can be stopped in more situations.
2025-12-11 18:53:47 -08:00
Michael Gottesman
d64fda488e [rbi] When looking for closure uses, handle unresolved_non_copyable_value and store_borrow temporaries.
This ensures that in cases like the following:

+func testNoncopyableNonsendableStructWithNonescapingMainActorAsync() {
+  let x = NoncopyableStructNonsendable()    <=========
+  let _ = {
+    nonescapingAsyncClosure { @MainActor in
+      useValueNoncopyable(x) // expected-warning {{sending 'x' risks causing data races}}
+      // expected-note @-1 {{task-isolated 'x' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses}}
+    }
+  }
+}

We emit the diagnostic on the use instead of the <=====.

rdar://166347485
2025-12-11 18:45:06 -08:00
Michael Gottesman
8bea3518f5 [rbi] Remove highlights from errors.
I have noticed over time when working on the command line, we often times
highlight too large of an expression due to the locations provided to us by
earlier parts of the compiler. This isn't technically necessary and the
following doesn't look nice... so remove it.

```
test5.swift:171:16: error: sending 'x' risks causing data races [#SendingRisksDataRace]
169 |   let _ = {
170 |     nonescapingAsyncUse { @MainActor in
171 | _ _ _ _ _u_s_e_V_a_l_u_e_(_x_)
    |                |- error: sending 'x' risks causing data races [#SendingRisksDataRace]
    |                `- note: task-isolated 'x' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses
172 |     }
173 |   }
```
2025-12-11 17:29:20 -08:00
Mishal Shah
ef9e3efaaf Merge pull request #85995 from swiftlang/revert-85542-revert-85534-revert-71422-docc
Revert "Revert "Revert "build: setup a CMake based build for DocC"""
2025-12-11 16:27:53 -08:00
Mishal Shah
6f32ad0dae Revert "Revert "Revert "build: setup a CMake based build for DocC""" 2025-12-11 16:25:44 -08:00
Saleem Abdulrasool
9918933045 Merge pull request #85896 from Steelskin/fabrice/update-bootstrap-arm64-toolchain
utils: Update the bootstrap Windows toolchain
2025-12-11 16:02:30 -08:00
Karoy Lorentey
a233485029 Merge pull request #82055 from vanvoorden/string-identical
[SE-0494][StdLib] Add `isTriviallyIdentical(to:)` Methods to String and Substring
2025-12-11 15:55:11 -08:00
Saleem Abdulrasool
54f5837c7b swift-scan-test: adjust frontend detection for Windows
Ensure that we account for file system arc separators and extensions by
using the LLVM functions rather than trying to simply do string
matching. This allows us to properly handle inputs on Windows.
2025-12-11 15:29:56 -08:00
Andrew Trick
d609889e87 Merge pull request #85934 from atrick/fix-closure-liveness
Fix InteriorUseWalker: consider partial_apply [on_stack] an escape
2025-12-11 15:05:21 -08:00
Ben Cohen
9dd9e96e1d Allow Hashable: ~Copyable (#85748)
Builds on #85746 which covers Equatable.
2025-12-11 14:47:36 -08:00
Ben Barham
b8e3e4b7b2 Merge pull request #85966 from bnbarham/disable-userdoc-freebsd
[Test] Disable userdoc validation on freebsd
2025-12-12 08:00:29 +10:00
Ben Barham
2dee8c4dac Merge pull request #85974 from bnbarham/so-long-and-thanks-for-all-the-fish
Remove Ben Barham from code owners
2025-12-12 07:58:16 +10:00
Meghana Gupta
f30b5841c4 Tolerate undef closure captures in ClosureLifetimeFixup
We may see undef closure captures in ClosureLifetimeFixup since
it is a mandatory pass that runs on invalid code as well.

This could sometimes hang the compiler while running `insertDeallocOfCapturedArguments`
in release builds.

This change adds a bailout when we see an undef closure capture to avoid running into this issue.
2025-12-11 12:16:12 -08:00
Pavel Yaskevich
6526dca9db [Concurrency] Add ApproachableConcurrency as a pseudo upcoming feature flag
Enables upcoming features that aim to provide a more approachable path to Swift Concurrency:
 - `DisableOutwardActorInference`
 - `GlobalActorIsolatedTypesUsability`
 - `InferIsolatedConformances`
 - `InferSendableFromCaptures`
 - `NonisolatedNonsendingByDefault`

Resolves: rdar://166244164
2025-12-11 10:36:03 -08:00
Dario Rexin
1f8e88d659 Merge pull request #85908 from drexin/wip-163631865
[IRGen] Use proper linkage for async function pointers to partial app…
2025-12-11 09:52:51 -08:00
Joe Groff
560eb9deaa Merge pull request #85954 from jckarter/sil-require-require-instruction
SIL verifier: The `atInstruction`/`atArgument` parameter to `require` should not be optional.
2025-12-11 09:43:43 -08:00
Joe Groff
f9fcd88298 Merge pull request #85959 from jckarter/borrow-accessor-address-only-non-escapable
SIL: Handle address ReturnInsts from borrow accessors as yielding uses.
2025-12-11 09:43:27 -08:00
Evan Wilde
3b99b43d91 Merge pull request #85931 from etcwilde/ewilde/stringprocessing-flags
CMake: StringProcessing: More apple flags
2025-12-11 09:22:21 -08:00
Kathy Gray
fde49b8847 Diagnostics : Increase possibility for missed property diagnostic
Impact for an unknown property access was frequently higher than other options
on ambiguous selections, by 3 to 5 points, causing fix selections that were
farther away and frequently noted to be in accurate. This commit lowers the
impact to be in a similar range to other fixes and this causes property accesses
to be selected more proprotionaly.

In the existing test suite, this changed the diagnostic only in the case of
protocol composition, which was also discovered to be a flawed binding lookup.

Tests added for the property lookup, tests updated for protocol composition
(Including correcting a likely error in a test specification)
2025-12-11 16:08:22 +00:00
Gabor Horvath
181122edf9 [cxx-interop] Fix crashing on recursive enums
Introduce a cache that helps cutting the recursion when we process a
type that we already visited before but did not finish processing yet.

Fixes #85361

rdar://164153038
2025-12-11 15:24:03 +00:00
Arnold Schwaighofer
c1c05e1298 Merge pull request #85948 from aschwaighofer/embedded_enable_existential_support
[embedded] Enable support for existentials/boxed protocol types per default
2025-12-11 07:16:26 -08:00
Anthony Latsis
9b2a7efbf2 SIL: Adjust pack isa after upstream LLVM implementation change
See https://github.com/llvm/llvm-project/pull/161403.

These `isa` calls with a `CanType` no longer compile with LLVM next
because the implementation now unfolds directly to `CastInfo` calls
rather than non-variadic `isa` calls that resolve to our partial
specializations here:

e293876e4f/include/swift/AST/Type.h (L600)

We should partially specialize `CastInfo` instead of `isa` et al. For
now, just use the non-variadic `isa`.
2025-12-11 14:18:47 +00:00