Commit Graph

100 Commits

Author SHA1 Message Date
Anton Korobeynikov
f2f1ae972e Outline stdlib ABI changes wrt coroutines 2025-11-13 12:34:16 -08:00
Xiaodi Wu
591fec274a [stdlib][SR-9438] Re-implement integer-to-string conversion (redux) (#85180)
Inspired by #84826, I've dusted off and completely reworked a native
implementation of integer-to-string conversion.

Besides existing tests in this repository, the core of the
implementation has been comprehensively tested in a separate package for
all bases between 2–36 to demonstrate identical output for all 8-bit and
16-bit values, and for randomly generated 32-bit, 64-bit, and 128-bit
values.

Resolves #51902.

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-11-03 21:23:12 -05:00
Henrik G. Olsson
6f1936ff73 Merge pull request #85059 from hnrklssn/swiftify-import-protocol
[Swiftify] Add _SwiftifyImportProtocol for safe overloads for protocols
2025-10-23 11:37:09 -07:00
Henrik G. Olsson
7c1fd54701 update failing tests 2025-10-22 18:25:57 -07:00
Stephen Canon
870acb5974 Move _float80ToStringImpl to the x86_64-specific ABI checker file. (#85002) 2025-10-20 05:28:48 -04:00
Tim Kientzle
f0679b363e Re-apply PR #82750: Reimplement floating-point description implementation in Swift.
This reverts PR #84576, which was a revert of PR #82750
It reverts commit 4ac18aa32e, reversing
changes made to b46eddbabd.
2025-10-07 07:11:57 -07:00
Tim Kientzle
7d85d75f78 Revert "Merge pull request #82750 from tbkka/tbkka-swift-floatingpointtostring"
This reverts commit 54627fb49b, reversing
changes made to dda4608a84.
2025-09-29 15:13:19 -07:00
Tim Kientzle
d8ba71629d Document false-positive API change 2025-09-24 14:46:02 -07:00
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
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
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
7cd98c31d4 [test] Update stability expectations 2025-03-24 12:16:04 -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
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
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
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
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
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
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
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
Allan Shortlidge
a1dacc12d7 stdlib: Make typed throws ABI placeholders properly @usableFromInline.
Functions that are used in public `@inlinable` function bodies can't be marked
`@_spi` nor can they be made obsolete. Also, they must retain `rethrows` so
that use of these entry points from other `rethrows` functions is accepted.

Builds on https://github.com/apple/swift/pull/72365. Once we no longer have to
support pre-`$TypedThrows` compilers, all of this can be reverted.

Part of rdar://125138945
2024-03-27 14:57:56 -07:00
Karoy Lorentey
c2f8d733dc [test] Update api-digester false positives lists 2024-03-21 13:53:58 -07:00
Karoy Lorentey
74bd1e385c [test] Fix mismerge in old ABI checker’s expectation list 2024-03-18 15:27:29 -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
11220bb3d0 ABI Tests: include Copyable/Escapable in baseline 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
3f9d93df76 [api-digester] fix exception omission
Update test/api-digester/stability-stdlib-abi-without-asserts.test
2024-03-08 09:01:11 -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
Guillaume Lessard
578a058797 Merge pull request #72052 from glessard/toplevel-withpointer-typed-throws
[stdlib] convert `withUnsafePointer()` to typed throws
2024-03-06 15:01:45 -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
fd726ccac3 [abi-digester] fix an exception
Update test/api-digester/stability-stdlib-abi-without-asserts.test
2024-03-05 09:24:13 -08:00
Guillaume Lessard
72e26f2d87 [api-digester] add more exceptions for typed throws 2024-03-05 03:06:42 -08:00
Guillaume Lessard
95c07e4688 [api-digester] add more exceptions for typed throws 2024-03-05 02:31:23 -08:00