Commit Graph

35 Commits

Author SHA1 Message Date
Doug Gregor
25bb3110aa Enable API stability checking for standard library on arm64
This test was only enabled for x86_64.
2024-08-16 13:04:03 -07:00
Kavon Farvardin
545844ce8f ASTPrinter: fix nested signatures with inverses
A generic signature's `getInnermostGenericParams` will find the generic
parameters in the innermost scope. That's not quite right for printing
inverses, since we don't want to print an inverse for `T` when emitting
the generic signature of `f` below:

```swift
    struct S<T: ~Copyable, E> {
        func f() where E == Never {}
    }
```

Since `f` has its own generic signature, but doesn't define any generic
parameters, it shouldn't have an inverse emitted. The solution here is
to filter inverses by depth of the generic parameter.

We also want to print _all_ of the inverses in other situations, rather
than just the innermost ones. This aids in debugging and other
tools like the API digester.

resolves rdar://130179698
2024-06-25 12:06:23 -07:00
Karoy Lorentey
8dddef63ba [test] Update source stability list of false positives 2024-06-07 14:09:53 -07:00
Nate Chandler
746cf2ff5b [BitwiseCopyable] Drop req from SIMD/Storage.
There are conformers to SIMDStorage (like that in the added test case)
which involve an Array (a type that can't conform to BitwiseCopyable).
So lift the constraint on SIMDStorage.  This in turn requires lifting
the constraint on SIMD (otherwise, e.g. `SIMD8<Scalar>` would fail to
conform since it has as a member some SIMD8Storage which is only
constrained to conform to `SIMDStorage`; the `SIMD8Storage`
associatedtype also cannot be constrained to `BitwiseCopyable` because
that storage may again not conform as in the test example).

rdar://128661878
2024-05-24 12:32:10 -07:00
Nate Chandler
b1fbe4ea91 [BitwiseCopyable] Remove underscore. 2024-04-25 11:44:15 -07:00
Karoy Lorentey
1b89293029 [api-digester] Update ceremonial confessions 2024-04-17 07:57:11 -07:00
Karoy Lorentey
a681a3d45e [api-digester] Ritually confess our sins 2024-04-16 11:21:08 -07:00
Stephen Canon
a381589524 SE-0425 implementation (#72139) 2024-04-02 16:24:41 -04:00
Karoy Lorentey
c2f8d733dc [test] Update api-digester false positives lists 2024-03-21 13:53:58 -07:00
Karoy Lorentey
6e77f85f92 [abi] Update false positives list for api-digester based ABI/source stability tests 2024-03-18 11:09:07 -07:00
Kavon Farvardin
cc709d676d Test: update baseline for NoncopyableGenerics 2024-03-14 23:10:44 -07:00
Guillaume Lessard
78273b2390 Merge pull request #72089 from glessard/toplevel-withUMP-typed-throws
[stdlib] convert `withUnsafeMutablePointer()` to typed throws
2024-03-08 13:52:23 -08:00
Guillaume Lessard
805dd70cfe Merge pull request #72074 from glessard/toplevel-withbytes-typed-throws
[stdlib] convert `withUnsafeBytes()` to typed throws
2024-03-08 08:55:08 -08:00
Nate Chandler
73231b185b [BitwiseCopyable] Don't apply to FixedWidthInteger.
Per LWG feedback.

This reverts commit c8119e3c01.
2024-03-06 08:12:54 -08:00
Guillaume Lessard
72e26f2d87 [api-digester] add more exceptions for typed throws 2024-03-05 03:06:42 -08:00
Guillaume Lessard
e02d8ab799 [api-digester] add more exceptions for typed throws 2024-03-05 02:25:52 -08:00
Nate Chandler
c8119e3c01 [stdlib] FixedWidthInteger is BitwiseCopyable. 2024-01-30 14:38:07 -08:00
Kuba Mracek
53ddf9bdf2 [embedded] Adjust stdlib stability test expectations after typed throws adoption 2024-01-18 20:56:20 -08:00
nate-chandler
7dd1d3f7c1 Merge pull request #70872 from nate-chandler/rdar19519745
[BitwiseCopyable] Infer and check constraint.
2024-01-16 07:01:31 -08:00
Nate Chandler
63de79c91e [stdlib] Pointers and SIMDs are bitwise copyable. 2024-01-15 17:08:32 -08:00
Doug Gregor
8912d4aa71 [SE-0413] Adopt typed throws in withoutActuallyEscaping(_:do:)
There is a small bug fix here in the identification of the catch node,
where the leading `{` of a closure was considered to be "inside" the
closure for code like

    { ... }()

causing us to assume that the call to the closure would catch the error
within the closure.

Other than that, introduce the thrown error type into the type checker's
modeling of `withoutActuallyEscaping(_:do:)`, and mirror that in the
library declaration.
2024-01-13 21:57:24 -08:00
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
f316c5fcfe Update tests for map switching to typed throws 2024-01-12 10:17:59 -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
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
Slava Pestov
2028a030f5 stdlib: Build with -requirement-machine-inferred-signatures=verify 2022-03-08 15:57:19 -05:00
Slava Pestov
76571c71e4 Update test/api-digester for rdar://problem/46313629 2022-02-04 19:10:59 -05: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
Guillaume Lessard
63aef41138 [test] list expected changes to MutableCollection 2021-07-28 10:29:18 -06: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
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Doug Gregor
d9e4184742 Make Error and CodingKey conform to ConcurrentValue.
Make both Error and CodingKey conform to ConcurrentValue, so that
thrown errors always conform to ConcurrentValue. Downgrade (to
warnings) and ConcurrentValue-related diagnostics that are triggered
by this change in existing Error and CodingKey-conforming types to
reduce the impact on source compatibility.
2021-02-20 22:01:28 -08:00
Mishal Shah
02b740378f [Apple Silicon] [Test] Generalize api-digester tests for Apple Silicon macOS.
Most of this is enabled by an upstream change to generalize the tests
for the api-digester to properly handle all targets. The primary change
here is to account for the Swift-level ABI differences for the standard
library between Apple Silicon macOS and Intel macOS. Specifically, anything
related to Float80 will be removed from the standard library on Apple Silicon
macOS, so account for the differences.
2020-07-02 17:57:59 -07:00