Baseline: tree as shared
This commit is contained in:
commit
659c03bbf8
1471 files changed
+990535
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# probe: mut arguments changing a caller's list and struct
|
||||
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
|
||||
# expect-stdout: 7
|
||||
# expect-stdout: [0, 10, 20, 30, 0, 10] 6
|
||||
@fieldwise_init
|
||||
struct Counter(Copyable, Movable):
|
||||
var hits: Int
|
||||
|
||||
|
||||
def bump(mut c: Counter, by: Int):
|
||||
c.hits += by
|
||||
|
||||
|
||||
def fill(mut xs: List[Int], n: Int):
|
||||
for i in range(n):
|
||||
xs.append(i * 10)
|
||||
|
||||
|
||||
def main():
|
||||
var c = Counter(0)
|
||||
bump(c, 3)
|
||||
bump(c, 4)
|
||||
print(c.hits)
|
||||
var xs = List[Int]()
|
||||
fill(xs, 4)
|
||||
fill(xs, 2)
|
||||
print(xs, len(xs))
|
||||
Reference in new issue
Block a user