Commit Graph

1996 Commits

Author SHA1 Message Date
Alejandro Alonso
73b0ad3622 Merge pull request #74122 from Azoy/dict-builder-condition
[stdlib] Guard for empty singleton in dictionary builder
2024-06-06 15:36:31 -07:00
Alejandro Alonso
1cda063fe0 Update Dictionary.swift 2024-06-06 11:02:47 -07:00
Finagolfin
a99b3748fe [android] Update tests to use new Android overlay and disable stdlib/Glibc.swift 2024-05-28 13:01:25 -07:00
Karl Wagner
31782df287 Re-enable StringNormalization validation test 2024-05-17 19:32:48 +02:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Yuta Saito
65723193a9 [embedded] Use @_extern(c) instead of @_silgen_name for putchar in tests
Using inconsistent attributes between stdlib and tests causes
compilation errors. There are still several misuses of @_silgen_name in
tests, but leaving them as is for now to incrementally fix them.
2024-04-11 10:37:25 +00:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Meghana Gupta
9112760248 Disable failing test on arm64 2024-04-09 11:53:57 -07:00
Meghana Gupta
85f960f366 Disable SequenceType.swift.gyb failing on freestanding 2024-04-08 10:16:16 -07:00
Nate Cook
38e1370884 Revert "Revert count(where:)" (#70816)
* Revert "Revert count(where:)"

This reverts commit 779ea19a6a.

Now that SE-0220 has been re-accepted, this adds the `count(where:)` 
Sequence method to the standard library.
2024-03-29 13:53:53 -05:00
Alejandro Alonso
4aa7a8bd3f Change availability guarding test 2024-03-19 15:42:42 -07:00
Alexis Laferrière
f1352f0919 tests: disable stdlib/StringGraphemeBreaking.swift on arm64e 2024-03-13 10:34:52 -07:00
cui fliter
127077b3aa chore: fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-05 17:23:22 +08:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -08:00
Stephen Canon
7a0c4b5e4a Add default implementations for FixedWidthInteger.dividingFullWidth (#70823)
These are provided for FixedWidthInteger & UnsignedInteger (the base implementation, following Knuth's Algorithm D) and SignedInteger (converting to magnitudes and calling the former). Previously no default implementations were available, requiring every type to implement these operations.

These defaults will not be optimal for large fixed-width integers, so types vending Int512 or similar integers should still provide their own implementations, but they are unconditionally available as a fallback, which simplifies the process of writing such types, and work well enough as a fallback for modest fixed-width integer types like Int64 or 32b or smaller platforms or Int128 on 64b platforms.

Additionally rework the concrete implementations to guarantee that we always trap when the quotient is not representable, and to improve performance for 64b integers on arm64_32, and added some new test coverage for these operations.
2024-01-12 15:25:01 -05:00
Jeremy Schonfeld
2404013f78 [SE-0270] Add Collection Operations on Noncontiguous Elements (#69766)
* Adds RangeSet/DiscontiguousSlice to the stdlib

* Remove redundant DiscontiguousSlice.Index: Comparable conformance

* Attempt to fix embedded build

* Attempt to fix macOS test failures

* Fix Constaints/members.swift failure on linux

* Add exceptions to ABI/source checker to fix macOS tests

* Fix incremental dependency test failure

* Remove inlining/unfreeze implementation for future improvements

* Simplify indices(where:) implementation

* Address review feedback

* Add test for underscored, public slice members

* Address feedback on inlining, hashing, and initializing with unordered arrays

* Fix ABI checker issues

* Remove MutableCollection extension for DiscontiguousSlice

* Make insertion return a discardable Bool

* Fix ABI checker tests

* Fix other ABI checker tests due to dropping MutableCollection subscript
2024-01-09 14:02:19 -08:00
honghoker
2fdb8b0481 Fix typo whiteSpace between line comment 2023-12-24 00:05:57 +09:00
Alejandro Alonso
3deacf8944 Fix backwards iteration of word breaking 2023-11-08 13:26:20 -08:00
Nate Cook
2c244b9698 Fix precondition in UMRBP.initialize(as:fromContentsOf:)
This precondition checks to make sure that the content-providing
collection isn't larger than the allocated buffer, but was preventing
using a buffer that is the exact same size as the collection.
2023-10-25 17:17:36 -05:00
Yuta Saito
4c8dc5bcb8 [test] Replace obsolete single_threaded_runtime feature with threading_none
The feature was renamed in 0cf687aa2b but
validation tests were not updated at that time.
2023-10-11 18:14:43 +00:00
Nate Cook
c7577bbe41 Disable stdlib tests under the OS stdlib
These two tests verify recent fixes, so they fail when run against
older versions of the stdlib.
2023-08-29 17:35:05 -05:00
Erik Eckstein
7f54c63b29 tests: Disable some tests which fail due to problems in Foundation
Those tests should be part of the Foundation overlay, which is no longer part of the Swift project.

rdar://112643333
2023-07-24 08:34:06 +02:00
Nate Cook
fb52491dcd Fix String capacity growth tests for watchOS
watchOS devices can have different allocation characteristics
from other devices. This modifies the string capacity growth
tests to be more flexible about measuring the growth in
capacity, specifically when more is allocated than requested.
2023-06-01 12:11:52 -05:00
Nate Cook
23c19333df [stdlib] Fix String.reserveCapacity underallocation (#65902)
When called on a string that is not uniquely referenced,
`String.reserveCapacity(_:)` ignores the current capacity, using
the passed-in capacity for the size of its new storage. This can
result in an underallocation and write past the end of the new
buffer.

This fix changes the new size calculation to use the current UTF-8
count as the minimum. Non-native or non-unique strings
now allocate the requested capacity (or space enough for the
current contents, if that's larger than what's requested).

rdar://109275875
Fixes #53483
2023-05-17 12:11:23 -05:00
Karoy Lorentey
b82ce9c3be [stdlib] Adopt _pointerBitWidth conditional 2023-04-27 13:33:24 -07:00
Alejandro Alonso
f16f0c3c23 Update the stdlib to use Unicode 15 data 2023-03-29 10:18:16 -07:00
Guillaume Lessard
d6a02682ad Merge pull request #64393 from glessard/rdar106656555-slowtest
[test] fix compilation performance issues in validation-test/stdlib/UnsafeBufferPointerSlices.swift
2023-03-17 10:22:07 -07:00
Matt Jacobson
2febbb4aaf stdlib: implement POSIXErrorCode for FreeBSD
It shares many of the same values as OpenBSD (which both inherited from 4.4BSD),
and we wouldn't expect those to diverge due to the respective platforms'
bincompat goals.
2023-03-16 01:20:56 -04:00
Guillaume Lessard
a441756ff4 [test] re-enable test/stdlib/UnsafeBufferPointerSlices 2023-03-15 10:54:24 -07:00
Guillaume Lessard
c5a59054d6 [test] simplify needlessly complex test expressions 2023-03-15 10:51:19 -07:00
Pavel Yaskevich
52f9d845da [Tests] NFC: Adjust REQUIRES declaration for UnsafeBufferPointerSlices validation test 2023-03-14 11:16:16 -07:00
Alejandro Alonso
b1107e4a3d Update UnsafeBufferPointerSlices.swift 2023-03-14 09:47:34 -07:00
Mishal Shah
e256b56545 Merge branch 'main' into rebranch 2023-03-02 18:25:09 -08:00
Andrew Trick
a354f26d55 Fix unit tests that relied on nontrivial to raw conversion. 2023-02-27 21:51:17 -08:00
Erik Eckstein
7ee2c105d5 tests: disable floating point conversion tests for the x86_64 simulator
There is a problem with 16-bit floating point conversions.

rdar://104232602
2023-01-16 09:58:23 +01:00
Karoy Lorentey
a3e517ed36 [stdlib] String: Fix forward implementation of grapheme breaking rule 11
Rule GB11 in Unicode Annex 29 is:

GB11: Extended_Pictographic Extend* ZWJ × Extended_Pictographic

However, our forward grapheme breaking state machine implements it as:

GB11: Extended_Pictographic Extend* ZWJ+ × Extended_Pictographic

We implement the correct rules when going backward, which can cause String values to have different counts whether we’re going forward or back.

The rule as implemented would be fine (Unicode doesn’t care much about the placement of grapheme breaks in invalid sequences), but the directional inconsistency messes with String’s Collection conformance.

rdar://104279671
2023-01-15 16:12:38 -08:00
Karoy Lorentey
4d9edad297 [test] Improve grapheme breaking tests
Instead of just checking the number of breaks in each test case,
expose and check the actual positions of those breaks, too.
2022-12-29 17:56:45 -08:00
Alsey Coleman Miller
62b7be4e9c [stdlib] Add RISCV64 support 2022-11-01 23:59:42 -07:00
Evan Wilde
64b19f7f45 Backdeploy task_wait_future fix to Swift 5.6 (#61254)
* Backdeploy swift_task_future_wait

This patch adds the implementation for `swift_task_future_wait`
entrypoint to the backdeploy library.

This involves pulling in `AsyncTask::waitFuture`, which relies on a fair
bit.

Please note, this pulls in the `StaticMutex` implementation from Swift
5.6. There are some challenges here. The concurrency version of the
`StaticMutex` involves a fairly nasty set of ODR violations in the
normal setup. See `public/Concurrency/Mutex.cpp`, which includes the
Mutex implementations cpp files directly, while defining a single macro
to replace the implementation of swift::fatalError with
swift_concurrency_fatalError. We only need the concurrency mutex (at
least for now), so I have hard-coded the `swift_concurrency_fatalError`
version into this library. If we should need the other implementation,
we are forced to include ODR-related undefined behavior.

We need symbols from C++, so I've added an implicit linker flag whenever
the static library is used, namely, it passes `-lc++` to the linker.
Since we only backdeploy on Apple platforms, this should be fine.

Some of the platform runtimes we need to backdeploy to have the
enter/exitThreadLocalContext functions defined, while others don't. We
define our own backdeploy56 shim function that dlsym's the function
pointer for these symbols if we have exclusivity checking available.
Otherwise, it doesn't do anything. If concurrency exclusivity checking
is available, we'll use it, otherwise we wont'.

The same dlsym check is done for `swift_task_escalate`. Not all
platforms we need to backdeploy to have a concurrency runtime. The
symbols that do need to use pieces of the concurrency runtime should not
be getting hit when deploying to systems that don't have concurrency. In
the event that you've gotten around the language blocking you from
calling these symbols and you've managed to call concurrency pieces
without using concurrency, we'll abort because something is seriously
wrong.

* Backdeploy swift_task_future_wait_throwing

Drop the remaining pieces in for adding
`swift_task_future_wait_throwing`.

* Apply task_wait_future fix

Actually apply the fix from ef80a315f8.

This deviates slightly from the original patch.

AsyncTask::PrivateStorage::_Status() does not exist in the Swift 5.6
library. Instead I am using `AsyncTask::PrivateStorage::Status`.

* Workaround missing compiler-rt linking

Working around the missing link against compiler-rt in these test.
They are a bit brittle as if anything in them uses compiler-rt, they
will start failing. The backdeploy 5.6 library uses some symbols from
compiler-rt, thus causes them to fail to link.

Disabling the runtime compatibility version checking to avoid these
symbols. This should be fine for the MicroStdlib test, but we should fix
'%target-ld' to handle this better in the future.
rdar://100868842
2022-10-07 09:36:17 -07:00
Anthony Latsis
73b6784946 Gardening: Migrate test suite to GH issues: validation-test/stdlib 2022-09-20 02:32:29 +03:00
Guillaume Lessard
8a146bc417 Merge pull request #61110 from glessard/rdar99933632-32bit-slice-loadUnaligned
[test] fix buffer overflow in 32-bit device testing
2022-09-15 04:48:31 -06:00
Guillaume Lessard
03c9ac9c98 [test] fix buffer overflow in 32-bit device testing 2022-09-14 16:24:16 -06:00
Guillaume Lessard
2689b6044b Merge pull request #41608 from glessard/se-pointer-family-initialization 2022-09-13 22:00:59 -06:00
Guillaume Lessard
71b6d99126 [test] fix a test warning 2022-09-11 05:17:22 -06:00
Guillaume Lessard
56c688777d [test] test overflow preconditions in collection copies 2022-09-09 18:02:43 -06:00
Guillaume Lessard
83c18dee6b Update validation-test/stdlib/UnsafeBufferPointerSlices.swift
Co-authored-by: Ben Rimmington <me@benrimmington.com>
2022-09-06 15:10:53 -06:00
Guillaume Lessard
3e22d3a2bc [test] update to use the fromContentsOf argument label 2022-08-26 17:36:40 -06:00
Guillaume Lessard
d86b727c80 [test] add tests for load and store from slices 2022-08-26 17:36:40 -06:00
Guillaume Lessard
d63747f13d [stdlib] remove the single-element update functions
- as per an update to the proposal
2022-08-26 17:36:40 -06:00