Commit Graph

26 Commits

Author SHA1 Message Date
Michael Gottesman
3ed4059a60 [sema] Change non-sendable -> non-Sendable in diagnostics.
This matches send non sendable but importantly also makes it clear that we are
talking about something that doesn't conform to the Sendable protocol which is
capitalized.

rdar://151802975
2025-05-22 11:37:58 -07:00
Michael Gottesman
3b8e384218 Fix another test.
Importantly since this test had a typechecker error within it, we do not get
return value diagnostics anymore since that occurs now at SIL time.
2024-12-02 16:54:13 -05: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
Alex Hoppen
66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00
Holly Borla
7dbec846f7 [NFC] Update a few tests for concurrency diagnostics changes. 2024-08-05 17:26:07 -07:00
Holly Borla
d40663dd66 [Concurrency] Flip the implicitly async select in a concurrency error.
This diagnostic was presenting "implicitly async" for explicitly async calls,
and vice versa, because the `select` was incorrect.
2024-07-31 06:46:07 -07:00
Kavon Farvardin
5230b19ef6 Test: replace '@_moveOnly' with '~Copyable' 2024-07-23 11:05:33 -07:00
Holly Borla
1a07152ee0 [NFC][Concurrency] Remove -disable-region-based-isolation-with-strict-concurrency
from tests.
2024-06-19 20:48:59 -07:00
Kavon Farvardin
c9cfe28e6d NCGenerics: improve diagnostics
Removing the old, ad-hoc diagnostics code improves the diagnostics we
emit, since the existing diagnostics for missing conformances is already
pretty good.

rdar://127369509
2024-06-04 15:06:32 -07:00
Michael Gottesman
b3e837c16c [region-isolation] Enable region isolation by default with strict-concurrency.
I added a disable flag -disable-region-based-isolation-with-strict-concurrency
so that we do not need to update the current tests. It is only available when
asserts are enabled to ensure users cannot use it.

rdar://125918028
2024-04-04 13:07:32 -07:00
Kavon Farvardin
47676b2248 Test: fix a number of NCGenerics-specific tests 2024-03-14 23:10:44 -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
Kavon Farvardin
3ab4c7548c Sema: ban extensions of known marker protocols
There's no good reason to permit them. Conformances like Copyable and
Sendable are pervasive, so it's as though we are permitting extensions
of `Any`. Until there's a good argument in favor of such extensions,
remove the capability now.
2024-02-07 14:54:36 -08:00
Kavon Farvardin
cc7a41fc2c [stdilb] introduce Copyable protocol
This replaces the old, unavailable `_Copyable`.

rdar://110420673
2023-09-21 00:55:17 -07:00
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