struct field declared type inference

This commit is contained in:
2026-07-20 16:14:34 +02:00
parent ad4802a270
commit 297f2e3078
2 changed files with 14 additions and 1 deletions
+10
View File
@@ -12,6 +12,13 @@ State :: struct {
arrlist_test std.ArrayList(Token) = arraylist.init(mem.c_allocator)
init func(allocator mem.Allocator) State {
return State {
tokens = arraylist.init(allocator),
diagnostics = arraylist.init(allocator),
}
}
hide fail_alloc func(_ ?@mut anyopaque, _ usize, _ usize) ?*mut u8 {
return none
}
@@ -34,6 +41,9 @@ hide fail_allocator mem.Allocator :: mem.Allocator {
}
run func() i32 ! mem.AllocError {
state State :: init(mem.c_allocator)
_ = state
values std.ArrayList(i32) = arraylist.init(mem.c_allocator)
defer arraylist.deinit(&values)
if (values.items.len != 0 or values.capacity != 0) return 1