Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 31f2fb8a5a
1679 files changed
+1024562

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
# probe: an early return: is the value destroyed before the return on that path?
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 run(flag: Bool) -> Int:
var a = L("a")
if flag:
print("returning early")
return 1
print("late uses", a.n)
return 2
def main():
print(run(True))
print("---")
print(run(False))