Commit Graph

90 Commits

Author SHA1 Message Date
Doug Gregor
7d74b3ba5c [SE-0413] Adopt typed throws in Result
Make `init(catching:)` and `get()` use typed throws. The former infers
the `Failure` type from the closure provided (once full type inference
is in place) and the latter only throws errors of the `Failure` type.
2024-01-13 06:45:08 -08:00
Doug Gregor
9bfca45432 Update ABI test for typed-throws map 2024-01-12 14:04:31 -08:00
Doug Gregor
f316c5fcfe Update tests for map switching to typed throws 2024-01-12 10:17:59 -08: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
Doug Gregor
3baf6ac31a Revert "[Typed throws] Support overrides that are contravariant in the thrown error" 2023-11-16 10:40:23 -08:00
Doug Gregor
b93e228f9d Update tests for map switching to typed throws 2023-11-13 14:13:44 -08:00
Yuta Saito
7df19b86ea [stdlib] Fix calling convention mismatch for debugger utility functions (#69352)
This is the 3rd attempt to fix the mismatch, where the actual definition
(e.g. `swift_retainCount`) are defined with C calling-convention and the
callers wrongly expect Swift calling-convention.

The 1st fix broke ABI compatibility by introducing new symbol references
from app-side without any availability checks.
The 2nd fix broke lldb's retain counting feature due to new x-ref to
Clang module in serialized function body by `@_alwaysEmitIntoClient`.

This attemps to avoid introducing serialized x-ref to Clang module by
using new `@_extern(c)` attribute.

Resolves rdar://113910821

Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2023-11-08 10:45:28 -08:00
Dario Rexin
29ce7a341d [Stdlib] Add some prespecializations to the stdlib (#66446)
* [Stdlib] Add some prespecializations to the stdlib

This adds prespecializations for commonly used types to the stdlib

* Add false positives to ABI checker ignore list

* Update multithread_module.swift

* Update multithread_module.swift

* Update multithread_module.swift
2023-07-06 15:27:09 -07:00
Nate Cook
89b9e48eae [stdlib] Implement Never conformance to Codable (#64899)
Proposed as SE-0396: Conform Never to Codable;
approved on 5/5/2023.
2023-05-09 13:10:10 -05:00
Allan Shortlidge
ba7472606d Tests: Update stability-stdlib-abi-without-asserts. 2023-05-05 18:26:59 -07:00
Guillaume Lessard
2689b6044b Merge pull request #41608 from glessard/se-pointer-family-initialization 2022-09-13 22:00:59 -06:00
Ben Pious
57d82317c1 Add CustomDebugDescription conformance to AnyKeyPath (#60133)
* initial

* it works

demangling mostly works

fix dots

printing works

add tests

add conformance to AnyKeyPath

implement SPI

subscripts fully work

comments

use cross platform image inspection

remove unnecessary comment

fix

fix issues

add conditional conformance

add types

try to fix the api-digester test

cr feedback: move impls behind flag, remove addChain(), switch statement, fallthrough instead of if-elses, move import

cr feedback: refactor switch statement

fix #ifdef

reindent, cr feedback: removes manual memory management

fix missing whitespace

fix typo

fix indentation issues

switch to regexes

checks should test in on all platforms

print types in subscripts

add test for empty subscript

Update test/api-digester/stability-stdlib-abi-without-asserts.test

Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>

add commas

fix failing test

fix stdlib annotation

cr feedback: remove global, refactor ifdef

cr feedback: switch back to manual memory management

switch to 5.8 macro

add new weakly linked functions to the allowlist

fix one more failing test

more cr feedback

more cr feedback

* fix invisible unicode
2022-09-13 09:23:32 -07:00
Guillaume Lessard
dfda525ae3 [abi] override the judgment of the abi stability test 2022-09-12 14:18:47 -06:00
Guillaume Lessard
8ed1fc739f [abi] override the judgment of the abi stability test 2022-08-26 17:36:40 -06:00
Guillaume Lessard
b0832cb13a [abi] override the judgment of the abi stability test 2022-08-26 17:36:40 -06:00
Anthony Latsis
5c0620bd08 Gardening: Migrate test suite to GH issues: api-digester 2022-08-11 17:43:23 +03:00
David Smith
f966017c9c Review feedback 2022-08-08 17:27:23 -07:00
Anthony Latsis
a12106963b stdlib: Mark some deprecated corelibs-foundation SPI that are no longer used as unavailable
This keeps them around in the ABI while preventing actual usage as we build
up confidence to finally remove them.
2022-07-26 04:29:57 +03:00
Slava Pestov
2734f3ca05 stdlib: Add SIMDMaskScalar.SIMDMaskScalar == SIMDMaskScalar requirement to SIMDScalar
In theory this is a source break if someone had a weird custom
conforming type, but I suspect in practice conformances to
this protocol are never defined.

The reason we want this requirement is that often you will see
code like the following:

  protocol Point {
    associatedtype Scalar: SIMDScalar
    associatedtype Vector: SIMD where Vector.Scalar == Scalar
  }

  extension Point where Vector == SIMD2<Scalar> { ... }

When `Vector` is equated with `SIMD2<Scalar>`, we get an infinite
sequence of implied same-type requirements:

  Vector.MaskStorage == SIMD2<Scalar.MaskScalar>
  Vector.MaskStorage.MaskStorage == SIMD2<Scalar.MaskScalar.MaskScalar>
  ...

The protocol fails to typecheck with an error because the requirement
machine cannot build a rewrite system.

If SIMDScalar requires that MaskScalar.MaskScalar == MaskScalar, then
we instead get

  Vector.MaskStorage == SIMD2<Scalar.MaskScalar>
  Vector.MaskStorage.MaskStorage == SIMD2<Scalar.MaskScalar>

  Vector.MaskStorage.MaskStorage == Vector.MaskStorage
  ...

Which ties off the recursion.

In theory, a more advanced implementation could represent this kind of
infinite recursion in 'closed form', but we don't have that yet, and I
believe adding this same-type requirement makes sense anyway.

Fixes rdar://problem/95075552.
2022-06-22 21:26:15 -04:00
Guillaume Lessard
838cd33c5a [test] fix false results from the ABI checker 2022-04-14 17:49:23 -06:00
Slava Pestov
e687234dc7 Move a few lines from stability-stdlib-abi-with-asserts.test to stability-stdlib-abi-without-asserts.test 2022-02-07 12:52:44 -05:00
Slava Pestov
76571c71e4 Update test/api-digester for rdar://problem/46313629 2022-02-04 19:10:59 -05:00
Artem Chikin
ea8209a484 Revert "test: update stability-stdlib-abi-with{out}-asserts.test" 2021-10-25 10:54:46 -07:00
Artem Chikin
a29f521725 test: update stability-stdlib-abi-with{out}-asserts.test
These new entries are false positives due to stale baselines that didn't record @_silgen_name.
2021-10-25 10:30:54 -07:00
Alejandro Alonso
7e0eaf7b99 Remove metadata section functions from the stdlib (#39236)
add aliases in test suite
2021-09-14 11:55:39 -07:00
Karoy Lorentey
2c50ae5118 [test] stability-stdlib-abi*: Mask out unstable parts of private names
The type `Hasher._Core` is `@frozen` but its stored properties are `private`, which currently makes them show up in api-digester ABI reports, leading to failures like this one:

```
+Var Hasher._Core._buffer has mangled name changing from 'Swift.Hasher._Core.(_buffer in _A19879A32F7D08A6DD54BABBA00BBA0C) : Swift.Hasher._TailBuffer' to 'Swift.Hasher._Core.(_buffer in _16630011A164FCBB1F12E5E0A3A7C863) : Swift.Hasher._TailBuffer'
```

These names aren't ABI impacting, so this checker probably should ignore their name changes. (The property names do appear in the .swiftinterface files, but IIUC the only their type and ordering matters.)

These ever-changing unstable ids make it impossible to add an entry to the expectation list that would allow these tests to pass. Work around this issue by postprocessing the reports to replace the unstable parts with the constant string `#UNSTABLE ID#`.

rdar://82552099
2021-09-01 17:39:52 -07:00
Stephen Canon
a3ba517837 Mark legacy overloads of &+ and &- unavailable. (#38723)
These were defined for both FixedWidthInteger and FixedWidthInteger & SignedInteger for source compatibility with Swift 3; the latter set probably should have been removed when we stabilized the ABI, but were not. We can't easily remove them entirely (because we need them for ABI stability now), but we can mark them unavailable so that the typechecker doesn't have to consider them..
2021-08-05 21:18:48 -04:00
Kyle Macomber
4c169c12ba Conform Never to Identifiable
rdar://75988520
2021-06-28 20:11:55 -07:00
Karoy Lorentey
40529fbe25 [stdlib][test] Update stdlib abi test docs 2021-04-28 15:39:01 -07:00
Karoy Lorentey
b11c6e42ea [stdlib][test] Update stdlib abi test docs 2021-04-28 14:10:06 -07:00
Doug Gregor
fcd5d43457 Revert "stdlib: Add reasync variants of '&&', '||' and '??'" 2021-04-05 16:45:44 -07:00
Slava Pestov
c473869141 stdlib: Add reasync variants of '&&', '||' and '??'
Fixes rdar://problem/72770687.
2021-03-31 19:21:08 -04:00
tbkka
26ab27648e Casting from AnyHashable to AnyHashable should never create another wrapper (#36470)
* Casting from AnyHashable to AnyHashable should never create another wrapper

This adds a conformance for _HasCustomAnyHashableRepresentation to
AnyHashable that simply returns self.  This ensures that anytime
you try to create a new AnyHashable wrapper for an existing
AnyHashable, you just get back the original.

Resolves rdar://75180619

* Move the `Struct AnyHashable` change to `without-asserts` list

As suggested by @lorentey
2021-03-22 09:03:29 -07:00
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Doug Gregor
364b245b4a Update test for intentionally-benign ABI change to standard library 2021-02-22 07:25:23 -08:00
Karoy Lorentey
70584f92b7 [test] Reinstate stdlib ABI checks
The noasserts flavor was previously XFAILed.

rdar://72856256
2021-02-02 21:32:07 -08:00
Mishal Shah
79324dfb4c Disable stability-stdlib-abi-without-asserts.test (72856256) 2021-01-07 09:41:05 -08:00
Nate Cook
e56a76baa7 Update API Digester test w/ temporary RangeSet removal (#35160) 2020-12-19 12:00:50 +00:00
Vedant Kumar
2308bb18b1 Add _getMetadataSection{,Count,Name} to API digester allow list (#33138)
These APIs are needed to build SwiftReflectionTest.swift when testing
Release builds.

This rolls back 014918c0, which hid these APIs in non-asserts builds
causing a failure:

  https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/5708/consoleText

rdar://66103895
2020-07-28 15:19:18 -07:00
Karoy Lorentey
a8c785b58a [test] Update & reenable stdlib ABI stability tests 2020-07-17 21:59:45 -07:00