Commit Graph

711 Commits

Author SHA1 Message Date
Guillaume Lessard
d1f7140357 [stdlib] apply the legacy ABI pattern to 3 functions 2025-08-12 16:15:13 -07:00
Guillaume Lessard
adae6a4b73 [test] acknowledge source-compatible API changes 2025-07-25 09:29:25 -07:00
Doug Gregor
642214d6cb Update test 2025-06-30 20:51:18 -07:00
Guillaume Lessard
401eef5472 [test] adjust api-digester data 2025-06-06 08:21:49 -07:00
Erik Eckstein
cac594fb86 Optimizer: peephole optimization for raw-value enum comparsions
Optimize (the very inefficient) RawRepresentable comparison function call to a simple compare of enum tags.
For example,
```
  enum E: String {
    case  a, b, c
  }
```
is compared by getting the raw values of both operands and doing a string compare.
This peephole optimizations replaces the call to such a comparison function with a direct compare of the enum tags, which boils down to a single integer comparison instruction.

rdar://151788987
2025-05-27 12:11:03 +02:00
Doug Gregor
22efac8e12 Revert "[Concurrency] adjust abi test for hashable async stream"
This reverts commit 99d95aa21d.
2025-05-05 10:43:07 -07:00
Konrad 'ktoso' Malawski
99d95aa21d [Concurrency] adjust abi test for hashable async stream 2025-04-28 20:05:42 +09:00
Anthony Latsis
1d6ed11e46 AST: Quote attributes more consistently in DiagnosticsModuleDiffer.def 2025-04-22 18:23:40 +01:00
Guillaume Lessard
ee50c3ec3a [test] amend api digester exceptions 2025-04-14 10:48:42 -07:00
Karoy Lorentey
86f6c29e34 [stdlib] Temporarily reinstate original ObjectIdentifier.init as public
The new generalization sometimes causes a runtime hang that I’m still analyzing. The original declaration should be considered more specific for preexisting use cases, eliminating the source compatibility issue.
2025-03-27 11:24:31 -07:00
Karoy Lorentey
192b404947 [stdlib] Work around ~Escapable breaking Optional.init syntax 2025-03-24 12:16:19 -07:00
Karoy Lorentey
21169d12e8 Reinstate generalization of Optional.unsafelyUnwrapped 2025-03-24 12:16:16 -07:00
Karoy Lorentey
e26ddca149 [test] Update list of false positives in source stability test 2025-03-24 12:16:14 -07:00
Karoy Lorentey
6ead0d8cd6 [stdlib] Postpone generalizing Result.flatMapError 2025-03-24 12:16:13 -07:00
Karoy Lorentey
c2d33b4f71 [stdlib] Take out generalization of Optional.unsafelyUnwrapped for now 2025-03-24 12:16:08 -07:00
Karoy Lorentey
801385ad49 [stdlib] Generalize the signature of type(of:)
`func type(of:)` is wholly magical, but it does have a signature in the stdlib (mostly for documentation purposes), and it currently requires its input to be copyable and escapable.

`type(of:)` is actually usable on all entities, so it seems desirable to update its signature to reflect this.

Additionally, this seems like a good time to mark its exported symbol obsolete. I don’t expect anyone would ever link to it (unless there is/was a bug), so in theory we could also silently remove it — but explicitly marking it as legacy ABI seems the least risky option.
2025-03-24 12:16:06 -07:00
Karoy Lorentey
7cd98c31d4 [test] Update stability expectations 2025-03-24 12:16:04 -07:00
Karoy Lorentey
538f2742ef [stdlib] Roll back generalization of the nil-coalescing operator ??
We cannot currently express its proper lifetime semantics: its result’s lifetime should depend on the intersection of the lifetime of the left argument and the lifetime of the result of the right argument.

`@lifetime(optional, defaultValue.result)` is what we want, but the `.result` part is not currently expressible. (Tying the dependency on the closure argument itself may be a viable option, but we aren’t confident enough to ship it like that yet.)
2025-03-24 12:16:01 -07:00
Karoy Lorentey
989ea16a0d [test] api-digester: Add false positives for newly generalized properties 2025-03-24 12:15:59 -07:00
Karoy Lorentey
e38c9d13a6 [test] Adjust more test expectations 2025-03-24 12:15:54 -07:00
Karoy Lorentey
b41d6aa63a [test] Ritually confess these changes 2025-03-24 12:15:53 -07:00
Guillaume Lessard
c21de062bb Merge pull request #78561 from glessard/rdar137710901-span-properties-prototype
[SE-0456] Span properties (part 1)
2025-03-24 08:47:47 -07:00
Alejandro Alonso
213dcbbb53 Update stability-stdlib-abi-without-asserts.test 2025-03-13 14:21:12 -07:00
Guillaume Lessard
063b0581e3 [test] ritual acts of contrition 2025-03-10 08:54:07 -07:00
Xi Ge
87877bd95f ABI checker: avoid diagnosing missing availability info for decls that are only explicitly available on visionOS
Resolves: rdar://145061506
2025-02-18 09:56:42 -08:00
Doug Gregor
e24598bca1 Use a marker protocol SendableMetatype to model T.Type: Sendable
Introduce a marker protocol SendableMetatype that is used to indicate
when the metatype of a type will conform to Sendable. Specifically,
`T: SendableMetatype` implies `T.Type: Sendable`. When strict
metatype sendability is enabled, metatypes are only sendable when `T:
SendableMetatype`.

All nominal types implicitly conform to `SendableMetatype`, as do the
various builtin types, function types, etc. The `Sendable` marker
protocol now inherits from `SendableMetatype`, so that `T: Sendable`
implies `T.Type: Sendable`.

Thank you Slava for the excellent idea!
2025-02-13 22:48:05 -08:00
Doug Gregor
88b28c3ff0 Update stdlib API stability now that @unsafe addition isn't considered "breaking" 2025-01-23 07:47:20 -08:00
Gabor Horvath
8c03a31d65 [cxx-interop] Support transforming lifetimebound spans
This PR adds basic support for storing lifetime dependence information,
transform Span return types, and generate lifetime annotations.

rdar://139074571
2025-01-21 10:51:04 +00:00
Henrik G. Olsson
d7bd76e9f1 [Swiftify] Add return pointer support (#78571)
* Import __counted_by for function return values

Instead of simply passing a parameter index to _SwiftifyInfo, the
_SwiftifyExpr enum is introduced. It currently has two cases:
 - .param(index: Int), corresponding to the previous parameter index
 - .return, corresponding to the function's return value.

ClangImporter is also updated to pass this new information along to
_SwiftifyImport, allowing overloads with buffer pointer return types to
be generated. The swiftified return values currently return Span when
the return value is marked as nonescaping, despite this not being sound.
This is a bug that will be fixed in the next commit, as the issue is
greater than just for return values.

* Fix Span variant selection

There was an assumption that all converted pointers were either
converted to Span-family pointers, or UnsafeBufferPointer-family
pointers. This was not consistently handled, resulting in violating the
`assert(nonescaping)` assert when the two were mixed. This patch removes
the Variant struct, and instead each swiftified pointer separately
tracks whether it should map to Span or UnsafeBufferPointer.
This also fixes return pointers being incorrectly mapped to Span when
marked as nonescaping.
2025-01-13 08:08:36 -08:00
Henrik G. Olsson
ef9d2b744d Rename pointer bounds (#78210)
* Make pointer bounds non-experimental

* Rename @PointerBounds to @_SwiftifyImport

* Rename filenames containing PointerBounds

* Add _PointerParam exception to stdlib ABI test

* Add _PointerParam to stdlib API changes

* Rename _PointerParam to _SwiftifyInfo
2024-12-20 11:36:01 +01:00
Doug Gregor
62d8659b15 Update API/ABI stability checker output for correctly-printed ''rethrows'
We used to treat 'rethrows' like an attribute, printing it as
'@rethrows', which was incorrect. That's fixed now, so update the
API/ABI checker tests to account for that.
2024-12-15 08:21:10 -08:00
Guillaume Lessard
20b85ed59d Merge pull request #76406 from glessard/rdar96837923-span 2024-11-07 18:25:49 -08:00
Hamish Knight
289092b9ec [api-digester] Avoid modeling ParenType
This isn't a useful node to record.
2024-10-24 15:13:06 +01:00
Guillaume Lessard
5e819aeea6 [stdlib] generalize isPOD() over suppressible protocols 2024-10-18 22:57:43 -07:00
Karoy Lorentey
0cb576773f [api-digester] Update classic ABI checker exception list 2024-10-08 11:11:04 -07:00
Doug Gregor
af49172b55 Mark Range.init(uncheckedBounds:) and ClosedRange.init(uncheckedBounds:) as @unsafe 2024-09-30 15:20:36 -07:00
Mike Ash
3937ceecc7 [Stdlib] Mark CVaListPointer as @unsafe.
rdar://135604375
2024-09-10 14:49:38 -04:00
Doug Gregor
5412a8a04c Move baseline updates over to the architecture-independent file 2024-08-19 22:14:09 -07:00
Doug Gregor
7e831f248b Update API test for addition of @unsafe 2024-08-19 14:33:58 -07:00
Doug Gregor
2e9ab88c4a Genereralize standard library ABI stability test for arm64 macOS
... and now that it is fixed for the platform I'm developing odd, add the
missing entries for typed throws on withUnsafe(Mutable)BufferPointer.
2024-08-16 21:28:30 -07:00
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
Doug Gregor
a47483c0ec Fix ABI issue with TaskLocal.withValue and update ABI test 2024-07-15 14:37:45 -07:00
Allan Shortlidge
20d97556ae stdlib: Remove #if $TypedThrows guards.
https://github.com/swiftlang/swift/pull/72612 can be reverted because it is no
longer necessary for the interface of the stdlib to be compatible with
compilers without `$TypedThrows` support.
2024-07-08 16:52:52 -07:00
Konrad `ktoso` Malawski
8bc53736e4 Merge pull request #73568 from ktoso/wip-fix-last-_unsafeInheritExecutor-usage
[Concurrency] Remove last usages of @_unsafeInheritExecutor
2024-06-26 22:01:28 +09: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
Konrad `ktoso` Malawski
0160fc367a [Concurrency] adopt #isolation in last remaining APIs 2024-06-24 11:44:44 +09:00
Karoy Lorentey
8dddef63ba [test] Update source stability list of false positives 2024-06-07 14:09:53 -07:00
Michael Gottesman
a890c6011e [sending] Do not mangle shared into function signatures if they are paired with sending.
I am doing this b/c we are going to ban borrowing sending so that we can leave
open that space for further design. In the short term, we need the ability to
create +0 sending parameters without messing with mangling. By special casing
this, we get what we want.

rdar://129116141
2024-06-01 23:25:16 -07:00
Holly Borla
135e3f2ee9 Merge pull request #73889 from hborla/deprecate-anyactor
[Concurrency] Deprecate `AnyActor`.
2024-05-30 09:36:35 -07:00
Holly Borla
c20b0e0956 [Concurrency] Obsolete AnyActor in Swift 6 using a typealias. 2024-05-29 22:59:19 -07:00