aboutsummaryrefslogtreecommitdiff
path: root/test/pointers.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-11-01 12:58:52 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-11-01 13:00:29 -0400
commit75bb38a10c9fa069cfbc731a1f50e4f977447987 (patch)
treeea73a85757262075f121d304846b256c7a82e54c /test/pointers.tm
parent874f7d750f39d154b9ecc9e7fb483eb6e7c43096 (diff)
Fix case where `foo.baz.method()` failed to pass `baz` as `(&(foo.baz))`
when `foo` was a `&Foo` and `baz.method()` takes a `&Baz`.
Diffstat (limited to 'test/pointers.tm')
-rw-r--r--test/pointers.tm13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/pointers.tm b/test/pointers.tm
new file mode 100644
index 00000000..9834044c
--- /dev/null
+++ b/test/pointers.tm
@@ -0,0 +1,13 @@
+struct Foo(x:Int)
+ func update(f:&Foo)
+ f.x += 1
+
+struct Baz(foo:Foo)
+ func update(b:&Baz)
+ # Make sure & propagates here!
+ b.foo.update()
+
+func main()
+ b := Baz(Foo(123))
+ b.update()
+ assert b.foo.x == 124