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.
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.
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.
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.
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]
```
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
- 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
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
the main things still left behind the experimental flag(s) are
- move-only classes (guarded by MoveOnlyClasses feature)
- noimplicitcopy
- the _borrow operator
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
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
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
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.
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.
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