Commit Graph

24 Commits

Author SHA1 Message Date
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
Allan Shortlidge
cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00
Kavon Farvardin
5230b19ef6 Test: replace '@_moveOnly' with '~Copyable' 2024-07-23 11:05:33 -07:00
Doug Gregor
bd696f9c05 Enable failable initializers for noncopyable types
Noncopyable types were prevented from having failable initializers
because `Optional` itself didn't support noncopyable types. Now
`Optional` does, so lift this restriction and add a test.
2024-04-01 17:29:41 -07:00
Karoy Lorentey
4b1477cc2c [test] Update tests for new stdlib 2024-03-18 11:08:32 -07:00
Kavon Farvardin
47676b2248 Test: fix a number of NCGenerics-specific tests 2024-03-14 23:10:44 -07:00
Kavon Farvardin
01864d9af4 Sema: replace legacy Copyable containment check
We can use part of the new infrastructure if we simply handle abstract
conformances to Copyable, which is what we'd get upon lookup for a
nominal in the old world. This means that we can merge diagnostics for
the containment test together, and fix differences with deinit
diagnostics.
2024-03-12 11:05:25 -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
swift-ci
44ab03a90b Merge pull request #66871 from kavon/generics-error-noncopyable
Be more specific than "noncopyable type T can't be used with generics yet"
2023-06-26 18:32:26 -07:00
Kavon Farvardin
ada0d335b1 have TypeCheckType be specific about the generic type a noncopyable was used with.
This change causes explicit types written in the
source language that substitute a noncopyable type
for a type variable in a generic type to state
that's what's wrong. For example:

```
// NEW: noncopyable type 'MO' cannot be used with generic type 'Dictionary<Key, Value>' yet
// OLD: noncopyable type 'MO' cannot be used with generics yet
let _: [MO : T]
```
2023-06-22 15:12:30 -07:00
Kavon Farvardin
79332c19b0 emit error when a noncopyable enum has a raw type
previously I was allowing these because I thought there was
some representational difference if the enum is raw. it
turns out that a raw enum is only useful if you synthesize
conformance to RawRepresentable. since I disabled that
synthesis it's kind of silly to still allow the raw type
to be written at all.

rdar://110539937
2023-06-21 11:21:49 -07:00
Kavon Farvardin
31aa2f77e3 polish noncopyable types diagnostic wordings
- replaces "move-only" terminology with "noncopyable"
- replaces compiler jargon like "guaranteed parameters"
  and "lvalue" with corresponding language-level notions
- simplifies diagnostics about closures.

and probably more.

rdar://109281444
2023-05-24 20:56:36 -07:00
Michael Gottesman
739417ff09 [move-only] Convert __shared to borrowing in move only tests.
These are the same semantically, just the mangling is slightly different. The
benefit of doing this is that we are actually testing what we expect our users
to do.

rdar://108511703
2023-04-25 10:51:04 -07:00
Kavon Farvardin
2c7d9a5047 update tests given move-only types are enabled
the main things still left behind the experimental flag(s) are
- move-only classes (guarded by MoveOnlyClasses feature)
- noimplicitcopy
- the _borrow operator
2023-03-14 18:35:13 -07:00
swift-ci
788f52bd1a Merge pull request #64124 from kavon/moveonly-no-effectful-accessor
disallow effectful getters for borrowed reads
2023-03-05 19:12:01 -08:00
Kavon Farvardin
2bf37b49cf disallow effectful getters for borrowed reads
This means properties returning noncopyable types or those
marked with `@_borrowed` can't have effects. The compiler
never accepted the latter correctly before.

The synthesized coroutine `read` calls the user-defined `get`,
but coroutines don't support `async` or `throws`.

resolves rdar://106260787
2023-03-05 16:40:49 -08:00
Kavon Farvardin
971ce817be disallow failable initializers for noncopyable types
These initializers implicitly return an optional of the
nominal type, but we can't wrap move-only / noncopyable
types inside of optionals at the moment, because that
would permit copying.

resolves rdar://106120881
2023-03-05 10:49:45 -08:00
Kavon Farvardin
60d9e614f2 prevent more synthesized conformances for move-only types
enums with only cases that have no associated values
automatically get Equatable and Hashable synthesized.

That's not valid for move-only enums, so we were
just getting errors about broken conformances when
we hadn't specified any explicitly.

This PR just prevents the synthesis from the start
so we don't get any errors.

fixes rdar://104986597
2023-02-10 10:02:43 -08:00
Kavon Farvardin
5b7eada4dd permit conformances in extensions of move-only types
previously we were blindly rejecting anything
that such extensions conformed to, but Sendable
is now allowed for move-only types.
2023-02-10 10:02:43 -08:00
Kavon Farvardin
d2da71a58c update existing tests after banning move-only types in generics
A number of our existing tests put move-only types in optionals and
used them as arguments to generic type parameters. It turns out that
many of these appearances in the tests were not crucial for the test's
functionality itself.

The little coverage for force-unwrapping an Optional<moveOnly>
that was lost will be regained once we make these types sound.

I also tried to tidy up some of the tests with consistent naming for
operations on values, i.e., `consumeVal` and `borrowVal` functions.
2023-02-01 23:38:28 -08:00
Kavon Farvardin
1356694043 experimentally allow move-only classes
A lot of existing regression tests rely on there
being some form of move-only classes, despite
them being something that will not be available
to users (and not complete).

This change introduces a `MoveOnlyClasses`
experimental feature so that those tests don't
need to be fully rewritten just yet. You need to
include `-enable-experimental-feature MoveOnlyClasses` along with
`-enable-experimental-move-only` to get move-only classes.
2023-01-23 22:33:27 -08:00
Slava Pestov
0f66cb6925 Sema: Use getLocalProtocols() instead of getAllProtocols() in move-only diagnostics 2022-11-12 02:13:54 -05:00
Michael Gottesman
51e90ee52c [move-only] Ban creating protocol conformances on move only nominal types.
I added code to the type checker that both bans this when one adds the
conformance on the nominal type declaration as well as on extensions. I was
careful to ensure we can still add extensions without an inherited clause.

Doing this until we get the full generics model.

rdar://101874019
2022-11-04 12:48:44 -07:00
Michael Gottesman
b95b19be44 [move-only] Ban move only types being stored properties of copyable types.
rdar://101650982
2022-11-04 11:56:31 -07:00