Commit Graph

3482 Commits

Author SHA1 Message Date
Guillaume Lessard 616e61a367 Merge pull request #89188 from glessard/rdar177198190-ref-mutableref-conformances 2026-05-18 13:00:24 -07:00
Guillaume Lessard d4e57530a5 [test] Ref and MutableRef conformances 2026-05-15 16:20:57 -07:00
Guillaume Lessard 79ac549c9e [test] add idiomatic availability requirements 2026-05-15 16:04:07 -07:00
Guillaume Lessard 459a3208c4 Merge pull request #89063 from glessard/rdar139816157-se0525-followup
[stdlib] remove functions deferred from SE-0525
2026-05-12 20:20:06 -07:00
Guillaume Lessard b61089961a [test] remove functions deferred from SE-0525 2026-05-12 15:24:13 -07:00
Alejandro Alonso f5561eaa4a Let Ref reference nonescapable types 2026-05-09 11:00:23 -07:00
David Smith ed3eec2cd1 Change String growth to resize by 1.625x instead of 2x (#88973)
Fixes rdar://59684914
2026-05-09 08:48:39 -07:00
David Smith f08afd00c3 Vectorize UTF16->UTF8 transcoding (#83073)
Fixes rdar://141789595
2026-05-08 11:49:00 -07:00
Guillaume Lessard 590bef642b Merge pull request #88788 from glessard/wasi-expectCrash-skip
[StdlibUnittest] Skip crash testing based on test runner feature rather than platform
2026-05-08 09:18:11 -07:00
Guillaume Lessard b55e6120ad [test] rename .requireCapability to .require in gyb tests 2026-05-07 19:13:53 -07:00
Guillaume Lessard cb85c226c0 [StdlibUnittest] rename .requireCapability to .require 2026-05-07 15:30:25 -07:00
Guillaume Lessard a2c9886d62 [test] replace wasi-based skips with feature-based requirements 2026-05-07 13:20:40 -07:00
Guillaume Lessard 45eb3ac16a [test] skip a test for a different WASI-related reason. 2026-05-07 13:20:39 -07:00
Guillaume Lessard a4c6bec0c2 [test] skip rather than avoid crash tests for WASI 2026-05-07 13:20:39 -07:00
David Smith 5039cccf80 Add a cross-encoding version of strcmp, use it in bridged String equality, and expose it for Foundation's use (#87271)
There's a longstanding problem in implementing `-isEqualToString:`,
where if you don't know how to get fast access to the other NSString's
contents, you have to pick between doing it character by character (very
slow), or calling [other isEqualToString: self], which risks infinite
recursion if the other string does the same.

This cuts the gordian knot by adding a new method
`isEqualToBytes:encoding:count:`, so you can get the contents out of
`self`, and hand it to the other string, confident that it will not need
to (nor, in fact be able to) ask you anything that might recurse.
2026-05-07 02:10:44 -07:00
Alejandro Alonso 6b960acf30 Merge pull request #88766 from Azoy/fix-box-test
[test] Change Box test to not be a FileCheck test
2026-05-05 10:26:45 -07:00
Guillaume Lessard 86c01256e2 [test] add an availability guard
- and fix discrepancies with internal branch
2026-05-04 12:24:33 -07:00
Doug Gregor 6c555aa605 Merge pull request #88786 from Azoy/borrow-to-ref
[stdlib] Rename Borrow and Inout to Ref and MutableRef
2026-05-03 22:02:17 -07:00
Doug Gregor 64e9cea4ab Merge pull request #88702 from glessard/rdar139816157-safe-loading-api-rawspan
[SE-0525] Safe loading API for `RawSpan` family
2026-05-03 21:52:19 -07:00
Ben Cohen 0c615e7d42 Remove old feature flag tests 2026-05-03 10:51:14 -07:00
Guillaume Lessard 5aed20039d [stdlib] rename append(elementCount:…)
Argument label `elementCount` becomes `upTo`.
2026-05-02 05:48:12 -07:00
Guillaume Lessard 728b64846d [test] don’t depend on Float16 2026-05-02 05:48:11 -07:00
Guillaume Lessard b030553b89 [test] fix two tests for wasi 2026-05-02 05:48:11 -07:00
Guillaume Lessard 001176b0a0 [test] make compatible with 32-bit targets 2026-05-02 05:48:11 -07:00
Guillaume Lessard 79f20b20e2 Update test/stdlib/Span/OutputRawSpanTests.swift 2026-05-02 05:48:10 -07:00
Guillaume Lessard 5007cf2bd8 [stdlib] consistency fixes 2026-05-02 05:48:09 -07:00
Guillaume Lessard 7c65afe773 [test] bitCast function 2026-05-02 05:48:09 -07:00
Guillaume Lessard 5390c91696 [test] validate new conformances and non-conformances 2026-05-02 05:48:09 -07:00
Guillaume Lessard e30a692e7d [test] SE-0525 additions to OutputRawSpan 2026-05-02 05:48:08 -07:00
Guillaume Lessard a61701237f [test] SE-0525 additions to MutableRawSpan 2026-05-02 05:47:48 -07:00
Guillaume Lessard 25a75244bc [test] SE-0525 additions to RawSpan 2026-05-02 05:47:17 -07:00
Guillaume Lessard 8215fc336a [test] SE-0525 addition to OutputSpan 2026-05-02 05:47:17 -07:00
Guillaume Lessard 66bf01916b [test] SE-0525 additions to MutableSpan 2026-05-02 05:47:16 -07:00
Guillaume Lessard 020af45f93 [test] SE-0525 additions to Span 2026-05-02 05:47:16 -07:00
Guillaume Lessard 070c664c0c [test] basic test for safe loading API 2026-05-02 05:46:28 -07:00
Alejandro Alonso b87c07a487 Rename Borrow and Inout to Ref and MutableRef 2026-05-01 16:54:42 -07:00
Guillaume Lessard 1bda8e21e3 [gardening] more line-length pruning 2026-05-01 14:12:00 -07:00
Guillaume Lessard b33db0b3a5 [test] replace fatalError with expectUnreachable
When testing, the unexpected should not be fatal.
2026-05-01 14:10:26 -07:00
Guillaume Lessard 8716b95f89 [test] skip tests rather than use conditional compilation 2026-05-01 14:10:16 -07:00
Guillaume Lessard 191408e05a [test] temporary allocation tests with -strict-memory-safety 2026-05-01 14:07:58 -07:00
Max Desiatov dcd67ec3ee Add OutputRawSpan overload of withTemporaryAllocation 2026-05-01 00:14:51 +01:00
Alejandro Alonso 65deea85c2 Add unittest import 2026-04-30 15:04:10 -07:00
Max Desiatov b347630fb7 withTemporaryAllocation: fix use of defer, add tests 2026-04-30 21:10:53 +01:00
Alejandro Alonso 2c31ecdaf1 Change Box test to use unittest library 2026-04-30 12:02:54 -07:00
Clinton Nkwocha 973d04d980 Revert "Reapply #87697 and fix overload resolution for Sequence+AsyncSequence types. (#88442)" (#88713)
<!--
The main branch is now in convergence, which means major changes, such
as large refactoring or new features, should be avoided. This strategy
is intended to maintain the stability of the Swift 6.4 release leading
up to the May 4th branch. For any work that requires broad changes or
introduces new features, create a feature branch and open a draft pull
request. All updates to the swiftlang/swift repository’s main branch
require approval from the release managers. A pull request targeting
swiftlang/swift will automatically add release managers. You can also
contact them via @release-managers in the forum group.
-->

<!-- Please fill out the following form: --> 
- **Explanation**: This reverts commit
5ece334724 which aimed to generalize
Sequence methods for typed throws and resolve its side effects on
overload resolution when a type conforms to both Sequence and
AsyncSequence. There appears to be, at least, one more unanticipated
side-effect, hence this pre-emptive revert in view of the soon-to-be
Swift 6.4 release branching.
  <!--
A description of the changes. This can be brief, but it should be clear.
  -->
- **Scope**: The said commit is reverted, preserving the recent
~Copyable/consuming alterations to Sequence.reduce(\_:\_:) (#85716).
  <!--
An assessment of the impact and importance of the changes. For example,
can
  the changes break existing code?
  -->
- **Issues**: Under investigation 
  <!--
  References to issues the changes resolve, if any.
  -->
- **Risk**: Low
  <!--
  The (specific) risk to the release for taking the changes.
  -->
- **Testing**: None
  <!--
  The specific testing that has been done or needs to be done to further
  validate any impact of the changes.
  -->

<!--
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!
-->
2026-04-30 16:01:48 +01:00
Max Desiatov 5b97cb7c1f Fix KeyPath with 16-byte-aligned subscript traps on 32-bit targets (#88725)
- **Explanation**: Fixes a crash with key paths on 32-bit platforms reproducible for types that have 16-byte alignment.
The intended bit layout of `ComputedArgumentSize` in `KeyPath` on 32-bit is:
```
 ┌───────┬───────────┐
 │ bits  │   field   │
 ├───────┼───────────┤
 │ 0–27  │ size      │
 ├───────┼───────────┤
 │ 28–29 │ padding   │
 ├───────┼───────────┤
 │ 30–31 │ alignment │
 └───────┴───────────┘
```
Currently, `alignmentMask = 0x6000_0000`, i.e. bits 29–30, not 30–31. It overlaps paddingMask (bits 28–29) at bit 29, meaning that alignment and padding unintentionally share a bit. With `alignmentShift = 30`, storing `shift = 2 << 30` places 1 at bit 31, which the mask doesn't cover.

Correct value is `0xC000_0000` covers bits 30–31, which matches `alignmentShift = 30` so both `shift = 1` and `shift = 2` round-trip, and it does not overlap with `paddingMask = 0x3000_0000` (bits 28–29). It also mirrors the 64-bit layout (top bits of the word reserved for alignment, just 2 of them instead of 1).
- **Scope**: Limited to 32-bit platforms.
- **Issues**: rdar://175799967
- **Risk**: Low due to increased test coverage.
- **Testing**: Previously crashing on 32-bit platforms sample code is now added to the test suite.
2026-04-29 20:25:16 -07:00
Alejandro Alonso 7446fa2776 Merge pull request #86336 from Azoy/box
[stdlib] Add UniqueBox
2026-04-28 13:21:17 -07:00
Alejandro Alonso 389a6499f4 Merge pull request #86039 from airspeedswift/nonescapable-hashable
Allow Hashable: ~Escapable
2026-04-28 10:31:35 -07:00
Alejandro Alonso f03a6087dd Merge pull request #85716 from airspeedswift/consume-reduce
Change reduce to take initial value consuming
2026-04-27 17:49:27 -07:00
Stephen Canon 2972c44201 Fix bug in String->Double conversion (#88682)
The existing code (new in 6.4) has a special case for when the exponent
was zero to do a straight conversion instead of splitting the integer
and doing an FMA. However, this either gave incorrect results or trapped
when signed `digits` was too large to fit into an `Int64`. The old
approach could be made to work without too much fuss, but we can also
just let this case fall through and use the non-zero exponent path,
which simplifies the code somewhat. We might want to rework all of this
in the future for further performance gains, but this simplifying fix is
totally straightforward and easy to take for now.

Resolves rdar://175568950

<!-- Please fill out the following form: --> 
- **Explanation**:
Eliminates a special case for String->Double conversion that introduced
a bug for certain values, allowing execution to fall through into more
general code that handles the special case correctly as well.
- **Scope**:
Narrowly-focused. Allows us to get the correct result for some inputs
that would otherwise regress in 6.4 and produce values of the wrong
sign.
- **Issues**:
rdar://175568950
- **Risk**:
Low
- **Testing**:
No special testing required; added new test cases to the stdlib tests to
exercise the paths in question.
2026-04-27 16:47:04 -07:00