Commit Graph

12 Commits

Author SHA1 Message Date
Nishith Shah
8e2e625543 [Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
This commit changes fixit messages from a question/suggestion to an
imperative message for protocol conformances and switch-case. Addresses
https://github.com/apple/swift/issues/67510.
2023-08-13 22:34:26 -07: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
c40985dfb3 describe how generic parameters implicitly require Copyable 2023-06-26 16:55:06 -07:00
Doug Gregor
740cd7bd61 [Distributed] Implement distributed actor semantics in call checking
The move to perform all call checking that can cross concurrency
domains into one place dropped the specific logic for distributed
actor calls. Introduce that logic, cleaning it up to consistently use
the "known to be local" semantics needed for distributed actors.
2023-06-26 13:39:56 -07:00
Kavon Farvardin
66bf3c03fc describe illegal casts to existentials 2023-06-23 20:15:01 -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
Kavon Farvardin
c948f3c04f add ownership to tests using noncopyable parameters 2023-02-16 22:08:13 -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
9a18422647 statically prevent runtime casts of move-only type
It appears that conditional casts require a check of the
type's metadata at runtime. There's no reason for us to
permit that at this time, since all such conditional
casts are going to fail, unless its the identity cast.

That is, a move-only type is currently only a subtype
of itself.

So for now, `is`, `as?`, `as!` casts from or to a
move-only type are now an error. The `as` casts
are permitted only if the two move-only types are
equal.
2023-02-07 16:51:46 -07:00
Kavon Farvardin
244cce0a09 allow move-only types to conform to Sendable
Part of the reason why we do not want to
permit conformance to protocols for
move-only types is that they're
fundamentally wrong: all existing protocols
assume the type is copyable, so we'd be
allowing people to write conformances to
things that are not actually true.

The other aspect of it is that we may
need to change the runtime representation
for conformance descriptors of move-only
types. So we can't have these conformances
leaving residue at runtime. Luckily, that
means marker protocols would be OK,
since they leave no residue at runtime.

So for, now we're going to specifically
permit move-only types to conform to the
marker protocol `Sendable` since it's needed
for move-only types to work with concurrency.

All of the existing rules about mixing
move-only types with generics still apply.
That means you still can't turn it into the
existential `any Sendable` in any way at all,
despite it conforming. The purpose of the
conformance is purely to allow the concrete
instances to cross actor isolation boundaries
if it is actually `Sendable`.

resolves rdar://104987062
2023-02-03 19:45:20 -08:00