Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 659c03bbf8
1471 files changed
+990535

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
# probe: moved out on one path only: on the other path, when does it die?
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("then after take")
else:
print("else body")
print("after if")
def main():
run(True)
print("---")
run(False)