Commit Graph

587 Commits

Author SHA1 Message Date
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07: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
Anthony Latsis
3f629315a9 Merge pull request #65731 from AnthonyLatsis/always-print-any
ASTPrinter: Turn on explicit `any` printing for everything and remove the option to disable it
2023-05-16 03:27:36 +03:00
Anthony Latsis
7f6d3bcd41 ASTPrinter: Turn on explicit any printing for everything and remove the option to disable it 2023-05-13 02:55:49 +03:00
Ellie Shin
73df9f2dd9 Merge pull request #65855 from apple/es-use-interface
Add test for api-digester loading a module with package name
2023-05-12 07:25:58 -07:00
Ellie Shin
32f7e3e9b7 Add a test for api-digest loading a module with package name
Ref: rdar://108945440
2023-05-11 16:58:43 -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
860b8cdf48 Concurrency: Revert workarounds for @backDeployed condfails.
All compilers that must be able to compile the standard library's textual
interface accept the following:
- back deployed functions declared without `@available`
- `@inlinable` back deployed functions
- `defer` blocks in back deployed functions

We can therefore revert the workarounds added in
https://github.com/apple/swift/pull/62946/ and
https://github.com/apple/swift/pull/62928/.

Resolves rdar://104085810
2023-05-08 18:21:08 -07:00
Allan Shortlidge
ba7472606d Tests: Update stability-stdlib-abi-without-asserts. 2023-05-05 18:26:59 -07:00
Allan Shortlidge
d1416ddd56 SILGen: Stub unavailable functions.
When `-unavailable-decl-optimization=stub` is specified, insert a call to
`_diagnoseUnavailableCodeReached()` at the beginning of the function to cause
it to trap if executed at run time.

Part of rdar://107388493
2023-05-03 15:19:31 -07:00
Allan Shortlidge
aef5e42457 Sema: Inherit SPI groups when synthesizing modify accessor.
Resolves rdar://108069565
2023-05-01 15:34:08 -07:00
Allan Shortlidge
7dc313f1be NFC: Fix tests that mistakenly rely on unavailable stored properties.
Preparation for rdar://107449845
2023-04-04 08:52:39 -07:00
Konrad `ktoso` Malawski
e0877594da [Concurrency] Custom executors with move-only Job (#63569) 2023-03-18 14:02:43 +09:00
Xi Ge
9a98766df2 ABIChecker: consider adding @_predatesConcurrency ABI-safe
We shouldn't diagnose adding @_predatesConcurrency without considering the context because the attribute itself is for ABI-preserving purposes.

rdar://90738915
2023-03-14 17:26:01 -07:00
Konrad `ktoso` Malawski
fffe782fac Enable Concurrency ABI verifier test on apple silicon (#63987) 2023-03-02 11:26:51 +09:00
Xi Ge
ba3cc288b6 ABI Checker: avoid reporting module importation changes
ABI changes due to imported module changes should be reflected by other symbol changes. Reporting
module import changes seems to be redundant.
2023-02-09 15:15:50 -08:00
Artem Chikin
6fd013aa67 Add an implicit dependency on the '_SwiftConcurrencyShims' library
Whenever concurrency mode is enabled in compilation. This avoids instead ad-hoc requests to load this module in SILGen.
2023-01-13 11:20:35 -08: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
Xi Ge
9ea86830ff ABI checker: we should also print ABI breakages when diagnostics are serialized
This ensures users can review ABI checker failures from build logs alone.

rdar://98624267
2022-08-29 13:26:17 -07: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
Slava Pestov
f0907d3e10 APIDigester: Stop calling getAllConformances() on protocols 2022-08-23 00:03:36 -04:00
Xi Ge
227c2ba9a1 ABI checker: adding protocol requirement with default implementation should not be flagged as breakage
rdar://98583968
2022-08-15 11:47:33 -07: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
Richard Wei
94e8f5393e Enable string processing by default.
Make frontend flag `-enable-experimental-string-processing` default to true.
2022-06-12 20:25:16 -07:00
Xi Ge
dfb53212d8 ABIChecker: add an option to avoid diagnosing about certain given SPI groups
rdar://92032848
2022-06-04 22:28:37 -07:00
Xi Ge
0567a9b142 ABI checker: include SPI group names in ABI descriptor files 2022-06-04 21:45:14 -07:00
Xi Ge
e46b5f5966 ABIChecker: for decls with @_originallyDefinedIn, use original module names in ABI descriptors
rdar://93615410
2022-06-03 22:41:43 -07:00
Xi Ge
7bab30c718 ABIChecker: diagnose moving a non-final member from a class to an extension to the class
rdar://93498817
2022-06-03 12:54:41 -07:00
Xi Ge
26952f74de ABI checker: include a field to indicate whether a decl is from extension 2022-06-03 12:54:11 -07:00
Josh Soref
55d9c8353b Spelling apidigester (#42542)
* spelling: analyzer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: considered

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: diagnostic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inherited

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interface

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: invoke

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: populating

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: referenced

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requirement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-22 18:53:51 -07:00
Guillaume Lessard
838cd33c5a [test] fix false results from the ABI checker 2022-04-14 17:49:23 -06:00
Yuta Saito
30b9fc90a8 Concurrency: fix inconsistent _asyncLet_get signatures 2022-03-30 20:58:40 +09:00
Evan Wilde
90b279bc66 Merge pull request #41933 from etcwilde/ewilde/concurrency-reland-runasyncmain-cleanups
Cleaning up _runAsyncMain
2022-03-21 16:59:34 -07:00
Evan Wilde
4700bc7e70 Add _runAsyncMain to api digester list
Adding `_runAsyncMain` to the api-digester list since we're adding
`@preconcurrency` when we add `@Sendable`. These two should negate each
other, but the api-digester isn't quite smart enough to understand that.
2022-03-21 13:02:20 -07:00
Slava Pestov
ae2feb5d8e Merge pull request #41663 from slavapestov/rqm-enable-stdlib-inferred-signatures
stdlib: Build with -requirement-machine-inferred-signatures=verify
2022-03-17 23:41:46 -04:00
Slava Pestov
2028a030f5 stdlib: Build with -requirement-machine-inferred-signatures=verify 2022-03-08 15:57:19 -05:00
Konrad `ktoso` Malawski
369f3e62d9 [Concurrency] ignore @_marker protocol AnyActor ABI warnings
These are not an issue because adding a @_marker protocol conformance has no ABI impact - the protocol is not available at runtime.
2022-03-08 20:00:27 +09:00
Philippe Hausler
b0f0cb257d Audit and correct AsyncSequence Sendability (#41253)
* Audit and correct AsyncSequence Sendability

* Annotate availability on Sendable conformances for AsyncSequences

* Fix typo of Sendable.Iterator

* Correct tests to use sendable builders

* Add @preconcurrency annotations and fixup one remaining missing @Sendable case

* Move preconcurrency to correct syntactical position

* Use unchecked Sendable conditional conformance instead of marking all internals as preconcurrency and sendable

* Use unchecked Sendable conditional conformance instead of marking all internals as preconcurrency and sendable for dropWhile

* claim ABI changes for marking of @preconcurrency as expected
2022-03-04 21:21:32 -08:00
Xi Ge
e1aaee4fec Frontend: add a frontend flag to generate empty ABI descriptors to workaround deserialization issues
ABI descriptors should always be emitted as sidecars for library-evolution-enabled modules.
However, generating these files requires traversing the entire module (like indexing), which may
hit additional deserialization issues. To unblock builds, this patch introduces a flag to skip
the traversing logic so that we emit an empty ABI descriptor file. The empty file serves as
a placeholder so that build system doesn't need to know the details.
2022-02-23 23:18:20 -08:00
Xi Ge
0992e97e5e ConstValues: record the values of const variable references in the side-car file 2022-02-21 19:22:25 -08:00
Xi Ge
23556aee05 ABIChecker: teach ABI descriptor JSON to also keep track of constant values known at compile-time
Emitted at the emit-module step, ABI descriptor is of an entensible JSON format. This patch sets
up a segment in the file to also keep track of all compile-time constant values for other tools
to consume. As the initial step, we only keep track of string literals in the source files.
2022-02-13 21:32:21 -08:00
Xi Ge
3ef8165626 ABI checker: refactor the format of the ABI descriptor JSON to be more extensible. NFC 2022-02-12 14:39:51 -08: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
Guillaume Lessard
1161f92bd7 Merge pull request #39529 from glessard/se-withMemoryRebound 2022-02-05 09:01:05 -07:00