Commit Graph

28 Commits

Author SHA1 Message Date
Henrik G. Olsson
cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00
Anthony Latsis
2cd90bdd69 AST: Quote attributes more consistently in DiagnosticsSema.def 2025-04-22 18:23:36 +01:00
Andrew Trick
64a48d08e1 Update tests for strict @lifetime type checking 2025-03-19 11:59:04 -07:00
Alejandro Alonso
c1bb143648 Make ValueGenerics feature always available 2025-02-27 10:03:37 -08:00
Meghana Gupta
e8abd59da5 Update tests 2024-11-18 18:09:19 -08:00
Nate Chandler
634eff6039 [Test] Enable some new parser round-tripping. 2024-11-11 07:40:14 -08:00
Nate Chandler
792f8d1760 [FixedArray] Fix BitwiseCopyable inference.
`FixedArray<T> : BitwiseCopyable` iff `T : BitwiwseCopyable`;
determining this requires using `checkConformance`, not
`lookupConformance`.
2024-11-08 11:06:48 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Nate Chandler
b1fbe4ea91 [BitwiseCopyable] Remove underscore. 2024-04-25 11:44:15 -07:00
Nate Chandler
016489e103 [BitwiseCopyable] Don't infer for @sensitive. 2024-04-24 15:52:20 -07:00
Nate Chandler
ed5c7ef7ae [BitwiseCopyable] Promote to feature.
SE-0426 was accepted.
2024-04-24 15:52:20 -07:00
Nate Chandler
6d57eab931 [BitwiseCopyable] Remove bespoke diagnostic.
Remove a diagnostic about conforming to Copyable now that a standard one
is emitted.

Also reenable the Sema/bitwise_copyable.swift test.

rdar://125934050
2024-04-04 15:24:07 -07:00
Kavon Farvardin
554fa49a1f Test: clean-up noncopyable_generics lit usage
There no longer is a lit feature called `noncopyable_generics`, it's
just always on now.
2024-04-01 12:28:08 -07:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Nate Chandler
187f434798 [BitwiseCopyable] Uniform inference for non-frozen
Don't key inference behavior off of library evolution mode.
2024-02-14 09:57:43 -08:00
Nate Chandler
81ae7463dd [BitwiseCopyable] Don't diagnose implicit checks.
Previously, the diagnostics for conforming a non-escaping or
non-copyable type to `_BitwiseCopyable` were emitted even in the case of
an implicit check for conformance.  Here this is fixed to suppress the
diagnostics in the case of an implicit check as is done for other
diagnostics.
2024-02-07 16:34:50 -08:00
Nate Chandler
79e6cbf6c3 [Test] Tested BitwiseCopyable for stdlib types.
To illustrate the behavior in interesting cases.
2024-02-02 17:10:50 -08:00
nate-chandler
f3189fb7be Merge pull request #71299 from nate-chandler/bitwise-copyable/non-resilient-module-public-inference
[BitwiseCopyable] Fragile modules always infer.
2024-02-01 03:22:03 -08:00
nate-chandler
902a22d94a Merge pull request #71298 from nate-chandler/bitwise-copyable/remove-unchecked
[BitwiseCopyable] Remove @unchecked behavior.
2024-02-01 03:21:26 -08:00
Nate Chandler
fecaf28938 [BitwiseCopyable] Fragile modules always infer.
Gating inference on visibility only makes sense in the context of a
resilient module.
2024-01-31 18:27:46 -08:00
Nate Chandler
05b4820c68 Revert "[BitwiseCopyable] Don't derive on @unchecked field"
This reverts commit d9e1755611.
2024-01-31 17:11:55 -08:00
Kavon Farvardin
5f977ca763 NCGenerics: force module mismatches 2024-01-31 14:00:08 -08:00
Nate Chandler
d9e1755611 [BitwiseCopyable] Don't derive on @unchecked field
Allow for a type to conform to BitwiseCopyable but not in such a way
that aggregates containing an instance will derive conformance
automatically.  Useful for types which don't involve reference counting
but nonetheless can't simply be copied bit-by-bit.
2024-01-30 08:50:13 -08:00
Nate Chandler
c0a3c16927 [Gardening] Test: Tweaked divider. 2024-01-25 07:22:13 -08:00
Nate Chandler
898737db0d [BitwiseCopyable] Require Copyable, Escapable.
In order to conform to _BitwiseCopyable, require that a type not be
~Copyable or ~Escapable.  Once the stdlib is built with the relevant
feature flags, that checking will occur automatically.  Until then, have
these bespoke diagnostics.
2024-01-25 07:22:12 -08:00
Nate Chandler
2133c94add [stdlib] Optional conforms to _BitwiseCopyable. 2024-01-15 17:08:32 -08:00
Nate Chandler
bac9e94a1d [BitwiseCopyable] Infer and check constraint.
When the BitwiseCopyable experimental feature is enabled, infer types to
conform to `_BitwiseCopyable`.  The `_BitwiseCopyable` inference broadly
follows the approach taken to infer `Sendable`.

(1) Special types are conformed:
- function types if trivial
- metatypes
- builtin types if trivial

(2) TheTupleType is conditionally conformed.

(3) Nominal types are conformed if:
- non-public or public+fixed-layout
- enum or struct (non-class)
- every field conforms to _BitwiseCopyable

Additionally, check that nominal types which are explicitly conformed to
`_BitwiseCopyable` satisfy the latter two conditions of (3).

For a public, non-fixed-layout type to conform to `_BitwiseCopyable`,
the user must conform the type explicitly.

Finally, verify that conformances correspond to TypeLowering's notion of
triviality to the appropriate extent:
- if a type isn't trivial, it doesn't conform to `_BitwiseCopyable`
  unless it's an archetype
- if a type is trivial, it conforms to `_BitwiseCopyable` unless some
  field in its layout doesn't conform to `_BitwiseCopyable`, which is
  only permitted under certain circumstances (the type has generic
  parameters, the type is public non-fixed-layout, the type is a
  reference but has ReferenceStorage::Unmanaged, the type is a
  ModuleType, etc.)
2024-01-15 17:08:32 -08:00