This commit is contained in:
commit
568474d52f
1591 files changed
+528213
No files matched your search
@@ -0,0 +1,30 @@
|
||||
# probe: moved out on one path, read after the branch: the compiler's words
|
||||
# expect: compile-error
|
||||
struct L(Copyable, Movable):
|
||||
var n: String
|
||||
|
||||
def __init__(out self, n: String):
|
||||
self.n = n
|
||||
print("init", n)
|
||||
|
||||
def __init__(out self, *, deinit move: Self):
|
||||
self.n = move.n^
|
||||
print("move", self.n)
|
||||
|
||||
def __deinit__(deinit self):
|
||||
print("bye", self.n)
|
||||
|
||||
|
||||
def take(var t: L):
|
||||
print("took", t.n)
|
||||
|
||||
|
||||
def run(flag: Bool):
|
||||
var a = L("a")
|
||||
if flag:
|
||||
take(a^)
|
||||
print(a.n)
|
||||
|
||||
|
||||
def main():
|
||||
run(True)
|
||||
Reference in new issue
Block a user