Commit Graph

3290 Commits

Author SHA1 Message Date
Nate Cook
ff86a69dd7 Add a StdlibUnitTest modifier for requiring a stdlib version (#79838)
It would be great if this could also set the availability for the `code:`
block, but this at least cuts out some boilerplate.
2025-03-08 13:07:20 -06:00
Guillaume Lessard
7214717fba Merge pull request #79708 from glessard/span-gardening
[SE-0447] Span and RawSpan tests
2025-03-07 22:00:58 -08:00
Guillaume Lessard
1a4105de6d [test] remove uninteresting tests 2025-03-07 13:23:25 -08:00
Guillaume Lessard
22ae9c9367 [test] portability fix 2025-03-07 13:23:25 -08:00
Ben Rimmington
ed5b3ca252 [stdlib] Add basic unit tests for InlineArray
FIXME: Empty array literals aren't supported.
2025-03-06 19:25:50 +00:00
Guillaume Lessard
bd32aa5f6e [stdlib] remove an extracting overload
- `RangeExpression` implicitly involves bounds checking, so this was misleading.
2025-03-05 17:15:03 -08:00
Guillaume Lessard
b70f0f622c [test] add RawSpan tests 2025-03-05 16:28:11 -08:00
Guillaume Lessard
16750f6de5 [test] add Span tests 2025-03-05 16:28:11 -08:00
Ben Rimmington
4bb3cf1496 [stdlib] Update WordPair: Comparable conformance (#79606) 2025-02-25 10:17:05 -08:00
Doug Gregor
654f8534bd Merge pull request #79399 from DougGregor/enable-span-everywhere
Enable usable of Span by default
2025-02-14 15:39:30 -08:00
Doug Gregor
3c8ef82963 Enable usable of Span by default
Usage of Span was temporarily behind an experimental feature flag. Now
that SE-0447 has been accepted, remove the experimental feature flag and
allow Span usage everywhere.

Implements rdar://144819992.
2025-02-14 10:45:47 -08:00
Philipp Gabriel
773561cc27 Expose attosecond representation of Duration (#78202)
* Add Int128 to Duration

* Update stdlib/public/core/Duration.swift

Co-authored-by: Stephen Canon <stephentyrone@gmail.com>

* Add unit tests for duration + attoseconds

* Add docs to duration + attosecond

* Update docs for attoseconds property

* Update stdlib.swift

* Update stdlib.swift

---------

Co-authored-by: Stephen Canon <stephentyrone@gmail.com>
2025-02-13 09:31:02 -05:00
Alejandro Alonso
0572eb9ef0 Merge pull request #78857 from Azoy/wordpair-comparable
[stdlib] Add Comparable conformance to WordPair
2025-01-29 11:20:56 -08:00
Alejandro Alonso
d2309d264d Fix tests 2025-01-28 12:50:51 -08:00
Alejandro Alonso
22d5acd207 Fix logic around comparison 2025-01-23 11:55:21 -08:00
Alejandro Alonso
d680396a09 Test comparable conformance 2025-01-23 10:14:19 -08:00
Philippe Hausler
c6a2437a10 [Observation] Exclude generic class types from pre-caching their keypaths (#78790)
* [Observation] Exclude generic class types from pre-caching their keypaths

* Account for multiple nesting levels of generics for observation cached keypaths
2025-01-21 23:49:37 -08:00
Alejandro Alonso
11fbd94668 Merge pull request #78664 from Azoy/unicode-16
[stdlib] Unicode 16
2025-01-21 09:29:35 -08:00
Alejandro Alonso
708d72d2c3 Update tests for 6.1 Unicode 16 stdlib 2025-01-15 14:09:57 -08:00
Guillaume Lessard
42ee081939 [test] correct compiler flags 2025-01-14 20:57:19 -08:00
Guillaume Lessard
fdddad6fa7 [test] exercise nonnative Array bridging 2025-01-14 17:08:36 -08:00
Evan Wilde
b492b716f6 Include std::to_string(long) in exported symbols
The GNU C++ runtimes added yet another symbol to our exported symbols
causing this test to fail. Adding it now: _ZNSt7__cxx119to_stringEl

rdar://142782295
2025-01-13 14:29:20 -08:00
Alexis Laferrière
11c448d954 Tests: Use a local cache for many tests importing AppKit
Tests importing AppKit have a tendency to be flaky if they share a
module cache with other builds using a different set of framework search
flags. Make sure they use a local cache to avoid picking incompatible
cached modules.

Alternatively, we could align all builds using the same cache to have
exactly the same framework search paths or enable explicit module
builds. I picked the module cache as it's the most reliable solution in
the short and long term.

The 5 tests below import AppKit and have been known to be flaky.
Adapting them to use a custom cache with require more care. For now,
let's use them as control group to validate that the fix works. If these
5 fail without the fixed ones, we should extend the same corresponding
fix to them.

- Interpreter/SDK/GLKit.swift
- Interpreter/SDK/cf_extensions.swift
- Interpreter/SDK/cf_type_bridging.swift
- Interpreter/SDK/mapkit_header_static.swift
- Interpreter/SDK/objc_ns_enum.swift

rdar://142296731
2025-01-09 12:22:02 -08:00
Allan Shortlidge
95cc7319a1 SIL: Revert public linkage for @_silgen_name forward declarations.
It turns out that the stdlib build depends on `internal` functions with
`@_silgen_name` getting hidden linkage in some configurations. Instead of
messing with the linkage computation, just fix the `stdlib/Error.swift` test by
making `setWillThrowHandler` `public` to give it the right linkage.

Resolves rdar://141590619.
2024-12-17 08:35:01 -08:00
Erik Eckstein
7cceaff5f3 SIL: don't print operand types in textual SIL
Type annotations for instruction operands are omitted, e.g.

```
  %3 = struct $S(%1, %2)
```

Operand types are redundant anyway and were only used for sanity checking in the SIL parser.

But: operand types _are_ printed if the definition of the operand value was not printed yet.
This happens:

* if the block with the definition appears after the block where the operand's instruction is located

* if a block or instruction is printed in isolation, e.g. in a debugger

The old behavior can be restored with `-Xllvm -sil-print-types`.
This option is added to many existing test files which check for operand types in their check-lines.
2024-11-21 18:49:52 +01:00
Doug Gregor
531a1ab4c4 Temporarily put uses of "Span" and "RawSpan" behind an experimental feature flag
While Span is present, we don't yet have an official way to create Span
instances. Until then, put uses of Span and RawSpan behind an
experimental feature flag (`Span`) that must be set to use these.

Addresses rdar://139308307.
2024-11-11 16:18:33 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
swift-ci
0de4a3ab21 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-21 12:35:00 -07:00
Allan Shortlidge
f827e7c6d3 Tests: Remove -disable-availability-checking in variadic generics tests. 2024-10-20 15:37:15 -07:00
swift-ci
f0b98875ec Merge remote-tracking branch 'origin/main' into rebranch 2024-10-11 17:33:30 -07:00
Nate Cook
9265743adc Add validation to CollectionDifference decoder (#76876)
The `CollectionDifference` type has a few different invariants
that were not being validated when initializing using the type's
`Decodable` conformance, since the type was using the
autogenerated `Codable` implementation. This change provides
manual implementations of the `Encodable` and `Decodable`
requirements, and adds tests that validate the failure when trying
to decode invalid JSON for CollectionDifference (and a few other
types).
2024-10-11 17:23:55 -07:00
swift-ci
e75d787e75 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-08 22:54:27 -07:00
Karoy Lorentey
ee4d4a33bd Merge pull request #75433 from lorentey/string-index-printing2 2024-10-08 22:34:03 -07:00
swift-ci
0f42bf27db Merge remote-tracking branch 'origin/main' into rebranch 2024-10-07 19:35:28 -07:00
Mike Ash
565c97ae07 Merge pull request #76800 from mikeash/reflection-test-no-timeout
[Test] Remove timeout from Reflection.swift and Reflection_objc.swift.
2024-10-07 22:09:42 -04:00
Karoy Lorentey
29cf262ef7 [stdlib] String.Index: conform to CustomDebugStringConvertible instead
Apply the LSG’s modifications as detailed in their review notes.
2024-10-07 17:00:13 -07:00
Karoy Lorentey
01792372a9 [stdlib] String.Index: conform to CustomStringConvertible
This better exposes the internals of string indices, demystifying their operation and radically simplifying working with them.
2024-10-07 16:02:16 -07:00
Mike Ash
0d14ab01ef [Test] Remove timeout from Reflection.swift and Reflection_objc.swift.
The timeouts have a comment about ASan tests taking hours, but that comment is a decade old and that doesn't seem to be the case now. Reflection_objc.swift does take over a minute to build with an ASan compiler, but that's tolerable.

rdar://134405526
2024-10-07 16:13:34 -04:00
swift-ci
78bf2cd399 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-02 14:54:18 -07:00
Mike Ash
4c385e4334 Merge pull request #76797 from mikeash/isequal-nil
[Runtime] Handle nil parameter to -[SwiftObject isEqual:]
2024-10-02 17:51:43 -04:00
swift-ci
61d5b48a52 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-02 08:15:55 -07:00
Egor Zhdan
7f597c63ae Merge pull request #76726 from swiftlang/egorzhdan/char8_t
[cxx-interop] Support `char8_t` C++20 type
2024-10-02 16:10:17 +01:00
Mike Ash
c928203780 [Runtime] Handle nil parameter to -[SwiftObject isEqual:]
The parameter is nullable, and isEqual: should always return nil in that case. We need to check for nil before doing anything else.

rdar://136825667
2024-10-01 14:05:39 -04:00
swift-ci
6abad3f648 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-30 09:15:23 -07:00
Doug Gregor
cd6864a5f3 Merge pull request #76454 from DmT021/wp/deprecated-diagnostic-groups
[Diagnostics] Add new groups to the 'deprecated' diagnostic group
2024-09-30 09:05:16 -07:00
Egor Zhdan
fcb590690e [cxx-interop] Support char8_t C++20 type
https://en.cppreference.com/w/cpp/keyword/char8_t

This is based on a patch from Varun Gandhi: https://github.com/swiftlang/swift/pull/26153

rdar://39988329 / resolves https://github.com/swiftlang/swift/issues/68726
2024-09-27 13:56:03 +01:00
Dmitrii Galimzianov
aa5e10f8d2 [Diagnostics] DeprecatedDeclaration group 2024-09-25 23:18:25 +02:00
swift-ci
510063d805 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-16 15:56:10 -07:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Ian Anderson
488c47b6be Import tgmath_h instead of Darwin.C.tgmath
Recent Apple SDKs moved tgmath.h from Darwin.C.tgmath to tgmath_h.

rdar://135982993
2024-09-13 17:56:58 -07:00