cli: preserve whole-array arguments for explicit array parameters

This commit is contained in:
dev committed 2026-10-07 22:29:45 +03:00
1 parent f733f7c7bb
commit dde801c653
44 files changed
+397 -9

No files matched your search

@@ -0,0 +1,42 @@
; expect: run
; result: 42
; phase: 1
; spec: docs/spec/07a-air-instructions.md; docs/spec/15-source-language.md §5
; Independent format-0 baseline: temporary borrows end before the next access.
module test.array_arguments
air 0
lang 0.1
features [arrays, effects, ownership]
fn @first(%a: ref<array<u64, 2>>) -> u64
effects []
entry:
%index = const.usize 0
%element = borrow.index %a, %index
%value = load %element
borrow.end %element
ret %value
fn @set(%a: mut<array<u64, 2>>) -> void
effects []
entry:
%answer = const.u64 42
%index = const.usize 0
%element = borrow.index %a, %index
store %element, %answer
borrow.end %element
ret
fn @main() -> u64
effects []
entry:
%data = local.alloc array<u64, 2>
local.zero %data
%writer = borrow.mut %data
call @set(%writer)
borrow.end %writer
%reader = borrow.ref %data
%answer = call @first(%reader)
borrow.end %reader
local.zero %data
ret %answer