make move use =wasMoved internally (#22032)

* make `move` use `=wasMoved` internally

* fixes tests

* fixes spawn finally

* fixes views

* rename to internalMove

* add a test case
This commit is contained in:
ringabout
2023-06-09 21:53:12 +08:00
committed by GitHub
parent 49e11d9dcc
commit 64b27edd3a
5 changed files with 50 additions and 11 deletions

View File

@@ -0,0 +1,14 @@
type
Foo = object
id: int
proc `=wasMoved`(x: var Foo) =
x.id = -1
proc foo =
var s = Foo(id: 999)
var m = move s
doAssert s.id == -1
doAssert m.id == 999
foo()