more forward declarations

This commit is contained in:
agra
2026-02-24 17:37:52 +02:00
parent 97475d6cfe
commit 566121c45a
13 changed files with 867 additions and 88 deletions

25
examples/issue-0002.sx Normal file
View File

@@ -0,0 +1,25 @@
#import "modules/std.sx";
// Issue: nested field assignment through pointer
// self.inner.field = value should work when self is a pointer
Inner :: struct {
len: s64;
cap: s64;
}
Outer :: struct {
inner: Inner;
count: s64;
reset :: (self: *Outer) {
self.inner.len = 0; // error: field assignment target must be a variable
self.count += 1;
}
}
main :: () {
o := Outer.{ inner = Inner.{ len = 5, cap = 10 }, count = 0 };
o.reset();
print("{}\n", o.inner.len);
}