From 05f7b7e09ad503e4eac4f757de0d7329174f6437 Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 05:55:19 +0000 Subject: analyzer: close the ownership gaps that stopped the compiler compiling itself an owned local can now move into a released owner declared in the same or an outer block, and g = m*x lends a local owner to a global until the global is assigned again in the same block. leaving that block, giving the local away, or returning while the lend is open is an error. recasting a plain local now names it and says it has no ownership to recast. methdef and syntax_resident use the supported spellings, so make genome reaches its fixpoint from a clean checkout. runerr.sh reads the first // expect: line, since the include headers moved it off line 1. --- tests/errors/move_live_owner.zc | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/errors/move_live_owner.zc (limited to 'tests/errors/move_live_owner.zc') diff --git a/tests/errors/move_live_owner.zc b/tests/errors/move_live_owner.zc new file mode 100644 index 0000000..e36909c --- /dev/null +++ b/tests/errors/move_live_owner.zc @@ -0,0 +1,5 @@ +namespace; +include rt; + +// expect: still owns an object; overwriting it would leak it +fn main() { word r = rt.new(4); { word n = rt.new(8); n[0] = 1; r = n; } r[0] = 2; return 0; } -- cgit v1.2.3