Commit Graph

5 Commits

Author SHA1 Message Date
Kavon Farvardin
5230b19ef6 Test: replace '@_moveOnly' with '~Copyable' 2024-07-23 11:05:33 -07:00
Kavon Farvardin
89ff3fe3f2 Test: update for BorrowingSwitch enablement 2024-05-13 13:08:32 -07:00
Kavon Farvardin
36451efb55 require consume x for noncopyable pattern bindings since they're consuming
this was staged in as a warning initially but it was intended to be
an error if it is not written so that we can move to a world where
these pattern matches are done as a borrowing operation instead.

rdar://110908714
2023-06-16 17:18:44 -07:00
Joe Groff
359e045192 Require switch on a noncopyable-type binding to be explicitly consume-d.
Pattern matching as currently implemented is consuming, but that's not
necessarily what we want to be the default behavior when borrowing pattern
matching is implemented. When a binding of noncopyable type is pattern-matched,
require it to be annotated with the `consume` operator explicitly. That way,
when we introduce borrowing pattern matching later, we have the option to make
`switch x` do the right thing without subtly changing the behavior of existing
code. rdar://110073984
2023-06-02 18:14:37 -07:00
Michael Gottesman
aa75e6d99f [move-only] Temporarily ban deinits on non-copyable enums.
The reason why we are doing this is that:

1. For non-copyable types, switches are always at +1 for now.
2. non-copyable enums with deinits cannot be switched upon since that would
invalidate the deinit.

So deinits on non-copyable enums are just not useful at this point since you
cannot open the enum.

Once we make it so that you can bind a non-copyable enum at +0, we will
remove this check.

I added an experimental feature MoveOnlyEnumDeinits so tests that validate the
codegen/etc will still work.

rdar://101651138
2023-03-28 16:07:15 -07:00