navid/veins / commit

8583d3056e25

Navid M <navidmomtahen@gmail.com> · 2026-11-25

parents: 9f8c34fecad9

Browse files at this commit · Download source

all: run critic -fix on solution
--- a/src/.gitignore+++ b/src/.gitignore@@ -1,3 +1,5 @@+vn-dev+vn vein-dev SPECTRE_LANGUAGE_REFERENCE.md lib/--- a/src/src/chunking/fastcdc.sx+++ b/src/src/chunking/fastcdc.sx@@ -52,7 +52,7 @@         if (fp & MASK_S) == 0 {             return i + 1         }-        i = i + 1+        i++     }     for i < limit {         val c2: u8 = trust @load8(@ptradd(data, i as i64))@@ -60,7 +60,7 @@         if (fp & MASK_L) == 0 {             return i + 1         }-        i = i + 1+        i++     }     return limit }--- a/src/src/cli/selftest_cmd.sx+++ b/src/src/cli/selftest_cmd.sx@@ -33,7 +33,7 @@     for i < n {         val v: u8 = ((i * 31 + seed * 17) % 251) as u8         @store8(@ptradd(p, i as i64), v)-        i = i + 1+        i++     } } @@ -43,8 +43,8 @@     val want: ref u8 = @alloc(32) as ref u8     val parsed: bool = objid.hex_decode(expected_hex, 32, want)     val same: bool = parsed && bytes.Bytes.eql(bytes.bytes(out, 32), bytes.bytes(want, 32))-    @free(out as ref void)-    @free(want as ref void)+    @free(out)+    @free(want)     return same } @@ -51,7 +51,7 @@ fn assert_id(id: objid.Id, expected_hex: ref u8) void = trust {     val hx: ref u8 = objid.Id.hex(id)     val same: bool = bytes.Bytes.eql(bytes.from_cstr(hx), bytes.from_cstr(expected_hex))-    @free(hx as ref void)+    @free(hx)     assert same } @@ -60,7 +60,7 @@     objid.hex_encode(data.ptr, data.len, hx)     @store8(@ptradd(hx, (data.len * 2) as i64), 0)     val same: bool = bytes.Bytes.eql(bytes.from_cstr(hx), bytes.from_cstr(expected_hex))-    @free(hx as ref void)+    @free(hx)     assert same } @@ -68,7 +68,7 @@     val digest: ref u8 = @alloc(32) as ref u8     b3.hash(data.ptr, data.len, digest)     assert_bytes_hex(bytes.bytes(digest, 32), expected_hex)-    @free(digest as ref void)+    @free(digest) }  fn fuzz_once(data: bytes.Bytes) void = trust {@@ -168,12 +168,12 @@             state = state ^ (state >> 7)             state = state ^ (state << 17)             @store8(@ptradd(data, j as i64), (state & 255) as u8)-            j = j + 1+            j++         }         fuzz_once(bytes.bytes(data, n))-        i = i + 1+        i++     }-    @free(data as ref void)+    @free(data) }  fn test_pack_layout() void = trust {@@ -275,7 +275,7 @@     @free(p1)     @free(p2)     @listfree(lens)-    @free(data as ref void)+    @free(data) }  fn write_one(repo: layout.Repo, kind: u8, body: bytes.Bytes) objid.Id = {@@ -322,7 +322,7 @@     val i: mut usize = 0     for i < 16 {         trust @store8(@ptradd(change, i as i64), (i + 11) as u8)-        i = i + 1+        i++     }     val sig: prim.Sig = prim.Sig{         name: bytes.bytes(c"Alice", 5),@@ -362,7 +362,7 @@     val id: objid.Id = write_one(repo, types.COMMIT, body)     val bp: mut ref void = body.ptr as ref void     trust @free(bp)-    trust @free(change as ref void)+    trust @free(change)     @listfree(parents)     @listfree(renames)     @listfree(extra)@@ -394,11 +394,11 @@     val bp: mut ref void = body.ptr as ref void     trust @free(bp)     for v in adds {-        val vp: mut ref void = v as ref void+        val vp: mut u8 = v         trust @free(vp)     }     for v in removes {-        val vp2: mut ref void = v as ref void+        val vp2: mut u8 = v         trust @free(vp2)     }     @listfree(adds)@@ -454,8 +454,8 @@     @listfree(tags)     @listfree(remotes)     @listfree(wcs)-    trust @free(bm as ref void)-    trust @free(wc as ref void)+    trust @free(bm)+    trust @free(wc)     return id } @@ -500,7 +500,7 @@     assert files.write_all(p, bytes.empty())     files.free_path(p)     files.free_path(dir)-    trust @free(hx as ref void)+    trust @free(hx) }  fn test_repository(repo: layout.Repo) void = trust {@@ -534,7 +534,7 @@         }         err e => {             stdio.eprint("selftest: cannot create repo ({d})\n", {e})-            @free(path as ref void)+            @free(path)             return 1         }     }@@ -541,7 +541,7 @@     test_repository(repo)     val status: i32 = fsck.check(repo, false)     layout.free_repo(repo)-    @free(path as ref void)+    @free(path)     if status != 0 {         stdio.eprint("selftest: fsck failed\n", {})         return 1--- a/src/src/core/buf.sx+++ b/src/src/core/buf.sx@@ -65,7 +65,7 @@     trust {         @store8(@ptradd(b.ptr, b.len as i64), v)     }-    b.len = b.len + 1+    b.len++ }  pub fn (Buf) put_u16_le(b: mut self, v: u16) void = {@@ -78,7 +78,7 @@     trust {         @store32(@ptradd(b.ptr, b.len as i64), v as i32)     }-    b.len = b.len + 4+    b.len += 4 }  pub fn (Buf) put_u64_le(b: mut self, v: u64) void = {@@ -86,7 +86,7 @@     trust {         @store64(@ptradd(b.ptr, b.len as i64), v)     }-    b.len = b.len + 8+    b.len += 8 }  pub fn (Buf) put_i16_le(b: mut self, v: i16) void = {@@ -103,7 +103,7 @@     }     Buf.reserve(b, n)     trust {-        @memcpy(@ptradd(b.ptr, b.len as i64), p as ref void, n)+        @memcpy(@ptradd(b.ptr, b.len as i64), p, n)     }     b.len = b.len + n }--- a/src/src/core/bytes.sx+++ b/src/src/core/bytes.sx@@ -59,7 +59,7 @@         if ca > cb {             return 1         }-        i = i + 1+        i++     }     if a.len < b.len {         return -1@@ -86,7 +86,7 @@         if ca != cb {             return false         }-        i = i + 1+        i++     }     return true }@@ -102,7 +102,7 @@ pub fn (Bytes) to_cstr(b: self) ref u8 = {     val out: ref u8 = @alloc(b.len + 1) as ref u8     if b.len > 0 {-        trust @memcpy(out as ref void, b.ptr as ref void, b.len)+        trust @memcpy(out, b.ptr, b.len)     }     trust @store8(@ptradd(out, b.len as i64), 0)     return out@@ -114,7 +114,7 @@         return empty()     }     val out: ref u8 = @alloc(b.len) as ref u8-    trust @memcpy(out as ref void, b.ptr as ref void, b.len)+    trust @memcpy(out, b.ptr, b.len)     return Bytes{ptr: out, len: b.len} } @@ -135,7 +135,7 @@         if trust @load8(@ptradd(b.ptr, i as i64)) != trust @load8(@ptradd(prefix.ptr, i as i64)) {             return false         }-        i = i + 1+        i++     }     return true }--- a/src/src/core/reader.sx+++ b/src/src/core/reader.sx@@ -43,7 +43,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u8 = trust @load8(@ptradd(r.data, r.pos as i64))-    r.pos = r.pos + 1+    r.pos++     return ok v } @@ -52,7 +52,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u16 = trust @load16(@ptradd(r.data, r.pos as i64))-    r.pos = r.pos + 2+    r.pos += 2     return ok v } @@ -61,7 +61,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u32 = trust (@load32(@ptradd(r.data, r.pos as i64)) as u32)-    r.pos = r.pos + 4+    r.pos += 4     return ok v } @@ -70,7 +70,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val v: u64 = trust (@load64(@ptradd(r.data, r.pos as i64)) as u64)-    r.pos = r.pos + 8+    r.pos += 8     return ok v } @@ -102,8 +102,8 @@             }             return ok value         }-        shift = shift + 7-        i = i + 1+        shift += 7+        i++     }     return err derr.fail(derr.ErrorKind.VarintOverflow, start) }@@ -146,7 +146,7 @@         return err derr.fail(derr.ErrorKind.UnexpectedEnd, r.pos)     }     val start: usize = r.pos-    r.pos = r.pos + 32+    r.pos += 32     return ok trust @ptradd(r.data, start as i64) } --- a/src/src/crypto/blake3.sx+++ b/src/src/crypto/blake3.sx@@ -115,7 +115,7 @@         g(out, 1, 6, 11, 12, block_word(block, msg_word(r, 10)), block_word(block, msg_word(r, 11)))         g(out, 2, 7, 8, 13, block_word(block, msg_word(r, 12)), block_word(block, msg_word(r, 13)))         g(out, 3, 4, 9, 14, block_word(block, msg_word(r, 14)), block_word(block, msg_word(r, 15)))-        r = r + 1+        r++     }      val i: mut usize = 0@@ -124,7 +124,7 @@         val hi: u64 = ldw(out, i + 8)         stw(out, i, mask32(lo ^ hi))         stw(out, i + 8, mask32(hi ^ ldw(cv, i)))-        i = i + 1+        i++     } } @@ -132,7 +132,7 @@     val i: mut usize = 0     for i < n {         stw(dst, i, ldw(src, i))-        i = i + 1+        i++     } } @@ -181,7 +181,7 @@     for i + 1 < total {         @memset(blk, 0, 64)         val blk_ptr: ref u8 = @ptradd(data, (i * 64) as i64)-        @memcpy(blk as ref void, blk_ptr as ref void, 64)+        @memcpy(blk, blk_ptr, 64)         val cf: mut u64 = 0         if i == 0 {             cf = CHUNK_START@@ -188,7 +188,7 @@         }         compress_into(out_cv, blk, counter, 64, cf, state)         copy_words(out_cv, state, 8)-        i = i + 1+        i++     }      @memset(out_block, 0, 64)@@ -195,7 +195,7 @@     val last_len: usize = len - (i * 64)     if last_len > 0 {         val blk_ptr2: ref u8 = @ptradd(data, (i * 64) as i64)-        @memcpy(out_block as ref void, blk_ptr2 as ref void, last_len)+        @memcpy(out_block, blk_ptr2, last_len)     }     val start_flag: mut u64 = 0     if i == 0 {@@ -205,8 +205,8 @@     @store64(out_counter, counter)     @store64(out_block_len, last_len as u64) -    @free(blk as ref void)-    @free(state as ref void)+    @free(blk)+    @free(state) }  /// Pack two 32-byte chaining values into a parent block.@@ -214,9 +214,9 @@     set_iv(out_cv)     val i: mut usize = 0     for i < 8 {-        @store32(@ptradd(out_block as ref void, (i * 4) as i64), ldw(left, i) as i32)-        @store32(@ptradd(out_block as ref void, ((i + 8) * 4) as i64), ldw(right, i) as i32)-        i = i + 1+        @store32(@ptradd(out_block, (i * 4) as i64), ldw(left, i) as i32)+        @store32(@ptradd(out_block, ((i + 8) * 4) as i64), ldw(right, i) as i32)+        i++     } } @@ -267,7 +267,7 @@         val total_so_far: mut u64 = i + 1         for mask32(total_so_far & 1) == 0 {             pop_cv(stack, depth - 1, left)-            depth = depth - 1+            depth--             parent_output(left, new_cv, out_cv, out_block)             @store64(out_flags, PARENT)             @store64(out_counter, 0)@@ -276,8 +276,8 @@             total_so_far = total_so_far >> 1         }         push_cv(stack, depth, new_cv)-        depth = depth + 1-        i = i + 1+        depth+++        i++     }      val last_off: usize = (i as usize) * 1024@@ -295,7 +295,7 @@      for depth > 0 {         pop_cv(stack, depth - 1, left)-        depth = depth - 1+        depth--         output_cv(             out_cv,             out_block,@@ -324,18 +324,18 @@         val word: u64 = ldw(scratch, j / 4)         val byte: u8 = ((word >> ((j % 4) * 8)) & 255) as u8         @store8(@ptradd(out, j as i64), byte)-        j = j + 1+        j++     } -    @free(stack as ref void)-    @free(scratch as ref void)-    @free(out_cv as ref void)-    @free(out_block as ref void)-    @free(out_flags as ref void)-    @free(out_counter as ref void)-    @free(out_block_len as ref void)-    @free(chunk_cv as ref void)-    @free(new_cv as ref void)-    @free(left as ref void)-    @free(cur_cv as ref void)+    @free(stack)+    @free(scratch)+    @free(out_cv)+    @free(out_block)+    @free(out_flags)+    @free(out_counter)+    @free(out_block_len)+    @free(chunk_cv)+    @free(new_cv)+    @free(left)+    @free(cur_cv) }--- a/src/src/io/files.sx+++ b/src/src/io/files.sx@@ -36,7 +36,7 @@     val p: ref u8 = @alloc(n + 1) as ref u8     trust {         if a.len > 0 {-            @memcpy(p as ref void, a.ptr as ref void, a.len as usize)+            @memcpy(p, a.ptr as ref void, a.len as usize)         }         if need_sep == 1 {             @store8(@ptradd(p, a.len), 47)@@ -70,7 +70,7 @@     val out: ref u8 = @alloc(n + 1) as ref u8     trust {         if p.len > 0 {-            @memcpy(out as ref void, p.ptr as ref void, p.len as usize)+            @memcpy(out, p.ptr as ref void, p.len as usize)         }         if suffix.len > 0 {             @memcpy(@ptradd(out, p.len), suffix.ptr as ref void, suffix.len as usize)@@ -87,7 +87,7 @@         if c == 47 {             return trust str.slice(p, i + 1, p.len)         }-        i = i - 1+        i--     }     return p }@@ -152,11 +152,11 @@ }  pub fn write_all(p: str.StringView, data: bytes.Bytes) bool = {-    return trust fs.write_all_bytes(p, data.ptr as ref void, data.len as i64)+    return trust fs.write_all_bytes(p, data.ptr, data.len as i64) }  pub fn append_all(p: str.StringView, data: bytes.Bytes) bool = {-    return trust fs.append_all_bytes(p, data.ptr as ref void, data.len as i64)+    return trust fs.append_all_bytes(p, data.ptr, data.len as i64) }  pub fn mkdir_all(p: str.StringView) bool = {@@ -188,7 +188,7 @@  pub fn free_names(names: list[ref u8]) void = {     for n in names {-        val p: mut ref void = n as ref void+        val p: mut usize = n         trust @free(p)     }     @listfree(names)@@ -209,7 +209,7 @@         if a != b {             return false         }-        i = i + 1+        i++     }     return true }--- a/src/src/main.sx+++ b/src/src/main.sx@@ -46,7 +46,7 @@                 mut_path = str.from_cstr(a)             }         }-        i = i + 1+        i++     }     return fsck_cmd.run(mut_path, verbose) }--- a/src/src/object/blob.sx+++ b/src/src/object/blob.sx@@ -61,7 +61,7 @@  pub fn free_build(b: ref BlobBuild) void = {     raw.free_objects(b.objects)-    val p: mut ref void = b as ref void+    val p: mut ref BlobBuild = b     trust @free(p) } @@ -90,11 +90,11 @@  pub fn free_blob(b: ref Blob) void = {     for e in b.entries {-        val p: mut ref void = e as ref void+        val p: mut ref BlobEntry = e         trust @free(p)     }     @listfree(b.entries)-    trust @free(b as ref void)+    trust @free(b) }  /// Decode and validate a blob body.@@ -139,7 +139,7 @@         }         total = next_total         @append(b.entries, new_entry(objid.id(cid), length))-        i = i + 1+        i++     }     reader.Reader.finish(r)?     return ok b@@ -184,7 +184,7 @@             @append(out, new_group(start, current))             start = i + 1         }-        i = i + 1+        i++     }     return out }@@ -198,7 +198,7 @@         val node = node_at(nodes, group.start + i)         buf.Buf.put_id(b, node.id)         buf.Buf.put_varint(b, node.length)-        i = i + 1+        i++     }     return b }@@ -208,7 +208,7 @@     val i: mut usize = 0     for i < group.count {         total = total + node_at(nodes, group.start + i).length-        i = i + 1+        i++     }     return total }@@ -215,7 +215,7 @@  fn free_groups(groups: list[ref Group]) void = {     for g in groups {-        val p: mut ref void = g as ref void+        val p: mut ref Group = g         trust @free(p)     }     @listfree(groups)@@ -223,7 +223,7 @@  fn free_nodes(nodes: list[ref NodeRef]) void = {     for n in nodes {-        val p: mut ref void = n as ref void+        val p: mut usize = n         trust @free(p)     }     @listfree(nodes)--- a/src/src/object/commit.sx+++ b/src/src/object/commit.sx@@ -69,7 +69,7 @@     for i < n {         val p: ref u8 = reader.Reader.read_id(r)?         @append(out, objid.id(p))-        i = i + 1+        i++     }     return ok out }@@ -118,7 +118,7 @@         prev_parent = parent_index         prev_path = to         have_prev = true-        i = i + 1+        i++     }     return ok out }@@ -135,7 +135,7 @@             return err derr.fail(derr.ErrorKind.InvalidValue, at)         }         @append(out, new_kv(key, value))-        i = i + 1+        i++     }     return ok out }@@ -172,7 +172,7 @@     val i: mut usize = 0     for i < @len(c.parents) {         buf.Buf.put_id(b, id_at(c.parents, i).ptr)-        i = i + 1+        i++     }     buf.Buf.put_id(b, c.root_tree.ptr)     buf.Buf.put_raw(b, c.change_id.ptr, 16)@@ -199,7 +199,7 @@  fn free_renames(rs: list[ref Rename]) void = {     for r in rs {-        val p: mut ref void = r as ref void+        val p: mut reader.Reader = r         trust @free(p)     }     @listfree(rs)@@ -207,7 +207,7 @@  fn free_kvs(xs: list[ref prim.KeyValue]) void = {     for kv in xs {-        val p: mut ref void = kv as ref void+        val p: mut ref prim.KeyValue = kv         trust @free(p)     }     @listfree(xs)@@ -217,6 +217,6 @@     @listfree(c.parents)     free_renames(c.renames)     free_kvs(c.extra)-    val p: mut ref void = c as ref void+    val p: mut ref Commit = c     trust @free(p) }--- a/src/src/object/conflict.sx+++ b/src/src/object/conflict.sx@@ -70,7 +70,7 @@     val i: mut usize = 0     for i < n {         @append(out, read_value(r)?)-        i = i + 1+        i++     }     return ok out }@@ -154,15 +154,15 @@  pub fn free_conflict(c: ref Conflict) void = {     for v in c.adds {-        val p: mut ref void = v as ref void+        val p: mut ref ConflictValue = v         trust @free(p)     }     for v in c.removes {-        val p: mut ref void = v as ref void+        val p: mut ref ConflictValue = v         trust @free(p)     }     @listfree(c.adds)     @listfree(c.removes)-    val p2: mut ref void = c as ref void+    val p2: mut ref Conflict = c     trust @free(p2) }--- a/src/src/object/id.sx+++ b/src/src/object/id.sx@@ -88,7 +88,7 @@             @store8(@ptradd(out, (i * 2) as i64), hex_digit(v >> 4))             @store8(@ptradd(out, (i * 2 + 1) as i64), hex_digit(v & 15))         }-        i = i + 1+        i++     } } @@ -115,7 +115,7 @@             return false         }         trust @store8(@ptradd(out, i as i64), ((hi * 16 + lo) as u8))-        i = i + 1+        i++     }     return true }--- a/src/src/object/names.sx+++ b/src/src/object/names.sx@@ -25,7 +25,7 @@         if c == 0 || c == 47 {             return false         }-        i = i + 1+        i++     }     if is_dot_name(b) {         return false@@ -50,7 +50,7 @@         if c == 0 || c == 47 {             return false         }-        i = i + 1+        i++     }     return true }@@ -75,7 +75,7 @@             }             start = i + 1         }-        i = i + 1+        i++     }     return true }--- a/src/src/object/operation.sx+++ b/src/src/object/operation.sx@@ -33,7 +33,7 @@     for i < n {         val p: ref u8 = reader.Reader.read_id(r)?         @append(out, objid.id(p))-        i = i + 1+        i++     }     return ok out }@@ -50,7 +50,7 @@             return err derr.fail(derr.ErrorKind.InvalidValue, at)         }         @append(out, new_kv(key, value))-        i = i + 1+        i++     }     return ok out }@@ -86,7 +86,7 @@     val i: mut usize = 0     for i < @len(op.parents) {         buf.Buf.put_id(b, id_at(op.parents, i).ptr)-        i = i + 1+        i++     }     buf.Buf.put_id(b, op.view.ptr)     buf.Buf.put_time_ms(b, op.start)@@ -107,10 +107,10 @@ pub fn free_operation(op: ref Operation) void = {     @listfree(op.parents)     for kv in op.tags {-        val p: mut ref void = kv as ref void+        val p: mut ref prim.KeyValue = kv         trust @free(p)     }     @listfree(op.tags)-    val p2: mut ref void = op as ref void+    val p2: mut ref Operation = op     trust @free(p2) }--- a/src/src/object/raw.sx+++ b/src/src/object/raw.sx@@ -21,7 +21,7 @@             val body_ptr: mut ref void = o.body.ptr as ref void             trust @free(body_ptr)         }-        val obj_ptr: mut ref void = o as ref void+        val obj_ptr: mut ref RawObject = o         trust @free(obj_ptr)     }     @listfree(objects)--- a/src/src/object/tree.sx+++ b/src/src/object/tree.sx@@ -57,7 +57,7 @@         if trust @load8(@ptradd(id.ptr, i as i64)) != 0 {             return false         }-        i = i + 1+        i++     }     return true }@@ -98,7 +98,7 @@         @append(t.entries, entry(name, kind, objid.id(tid)))         prev = name         have_prev = true-        i = i + 1+        i++     }     reader.Reader.finish(r)?     return ok t@@ -131,7 +131,7 @@         buf.Buf.put_id(b, e.target.ptr)         prev = e.name         have_prev = true-        i = i + 1+        i++     }     val out: bytes.Bytes = bytes.Bytes.dup(buf.Buf.view(b))     buf.Buf.free(b)@@ -140,10 +140,10 @@  pub fn free_tree(t: ref Tree) void = {     for e in t.entries {-        val p: mut ref void = e as ref void+        val p: mut ref TreeEntry = e         trust @free(p)     }     @listfree(t.entries)-    val p2: mut ref void = t as ref void+    val p2: mut ref Tree = t     trust @free(p2) }--- a/src/src/object/view.sx+++ b/src/src/object/view.sx@@ -64,7 +64,7 @@         if bytes.Bytes.at(b, i) == 0 {             return false         }-        i = i + 1+        i++     }     return true }@@ -91,7 +91,7 @@         @append(out, cur)         prev = cur         have_prev = true-        i = i + 1+        i++     }     return ok out }@@ -112,7 +112,7 @@             val p2: ref u8 = reader.Reader.read_id(r)?             @append(out, objid.id(p2))         }-        i = i + 1+        i++     }     return ok out }@@ -192,7 +192,7 @@         @append(out, bm)         prev = name         have_prev = true-        i = i + 1+        i++     }     return ok out }@@ -225,7 +225,7 @@         @append(out, t)         prev = name         have_prev = true-        i = i + 1+        i++     }     return ok out }@@ -275,7 +275,7 @@         prev_remote = remote         prev_name = name         have_prev = true-        i = i + 1+        i++     }     return ok out }@@ -308,7 +308,7 @@         @append(out, w)         prev = workspace         have_prev = true-        i = i + 1+        i++     }     return ok out }@@ -342,7 +342,7 @@     val i: mut usize = 0     for i < @len(v.heads) {         buf.Buf.put_id(b, id_at(v.heads, i).ptr)-        i = i + 1+        i++     }     buf.Buf.put_varint(b, @len(v.bookmarks) as u64)     for bm in v.bookmarks {@@ -379,25 +379,25 @@     @listfree(v.heads)     for bm in v.bookmarks {         free_target_set(bm.targets)-        val p: mut ref void = bm as ref void+        val p: mut ref Bookmark = bm         trust @free(p)     }     @listfree(v.bookmarks)     for t in v.tags {-        val p: mut ref void = t as ref void+        val p: mut ref TagRef = t         trust @free(p)     }     @listfree(v.tags)     for rr in v.remote_refs {-        val p: mut ref void = rr as ref void+        val p: mut ref RemoteRef = rr         trust @free(p)     }     @listfree(v.remote_refs)     for w in v.working_copies {-        val p: mut ref void = w as ref void+        val p: mut ref WorkspaceRef = w         trust @free(p)     }     @listfree(v.working_copies)-    val p2: mut ref void = v as ref void+    val p2: mut ref View = v     trust @free(p2) }--- a/src/src/store/fsck.sx+++ b/src/src/store/fsck.sx@@ -29,20 +29,20 @@ }  fn report(ctx: mut Ctx, path: str.StringView, msg: str.StringView) void = {-    ctx.errors = ctx.errors + 1+    ctx.errors++     trust stdio.eprint("fsck: {s}: {s}\n", {path, msg}) }  fn report_id(ctx: mut Ctx, path: str.StringView, msg: str.StringView, id: objid.Id) void = {-    ctx.errors = ctx.errors + 1+    ctx.errors++     val hx: ref u8 = objid.Id.hex(id)     trust stdio.eprint("fsck: {s}: {s} {s}\n", {path, msg, str.from_cstr(hx)})-    val p: mut ref void = hx as ref void+    val p: mut ref u8 = hx     trust @free(p) }  fn warn(ctx: mut Ctx, path: str.StringView, msg: str.StringView) void = {-    ctx.warnings = ctx.warnings + 1+    ctx.warnings++     if ctx.verbose {         trust stdio.eprint("fsck: warning: {s}: {s}\n", {path, msg})     }@@ -117,7 +117,7 @@         if !promised {             val msg: ref u8 = @fmtalloc("missing {s} object", {what})             report_id(ctx, path, str.from_cstr(msg), id)-            val mp: mut ref void = msg as ref void+            val mp: mut ref u8 = msg             @free(mp)         }         return promised@@ -128,7 +128,7 @@             {types.name(loc.kind), types.name(expected)}         )         report_id(ctx, path, str.from_cstr(msg2), id)-        val mp2: mut ref void = msg2 as ref void+        val mp2: mut ref u8 = msg2         @free(mp2)         return false     }@@ -359,7 +359,7 @@         {what, e.offset, derr.ErrorKind.name(e.kind)}     )     report(ctx, path, str.from_cstr(msg))-    val p: mut ref void = msg as ref void+    val p: mut ref u8 = msg     trust @free(p) } @@ -445,7 +445,7 @@     }     if eligible {         val visited: ref u8 = @alloc(p.count + 1) as ref u8-        @memset(visited as ref void, 0, p.count + 1)+        @memset(visited, 0, p.count + 1)         val j: mut usize = 0         for j < idx.count {             val iid: objid.Id = index.Index.id_at(idx, j)@@ -466,7 +466,7 @@                     report_id(ctx, pview, "index offset names no record for", iid)                 }             }-            j = j + 1+            j++         }         val k: mut usize = 0         for k < p.count {@@ -474,9 +474,9 @@                 report_id(ctx, pview, "record is not indexed", pack.Pack.id_at(p, k))                 eligible = false             }-            k = k + 1+            k++         }-        @free(visited as ref void)+        @free(visited)     }      if eligible {@@ -545,9 +545,9 @@                     report_decode(ctx, h.path, "record", e)                 }             }-            j = j + 1+            j++         }-        i = i + 1+        i++     } } @@ -629,7 +629,7 @@         val parsed: bool = objid.hex_decode(n, 32, raw_id)         if !parsed {             report(ctx, dir, "op_heads entry is not hexadecimal")-            @free(raw_id as ref void)+            @free(raw_id)             continue         }         @append(frontier, objid.id(raw_id))--- a/src/src/store/index.sx+++ b/src/src/store/index.sx@@ -62,7 +62,7 @@  pub fn free_index(idx: ref Index) void = {     files.free_buffer(idx.data)-    val p: mut ref void = idx as ref void+    val p: mut ref Index = idx     trust @free(p) } @@ -93,7 +93,7 @@         }         prev = v         last = v-        i = i + 1+        i++     }      val base: usize = 1032 + 64@@ -124,7 +124,7 @@         bytes.bytes(digest, 32),         bytes.Bytes.slice(data, index_trailer_off, data.len)     )-    trust @free(digest as ref void)+    trust @free(digest)     if !valid {         return err derr.fail(derr.ErrorKind.HashMismatch, index_trailer_off)     }@@ -133,7 +133,7 @@     }      val counts: ref u32 = @alloc(1024) as ref u32-    trust @memset(counts as ref void, 0, 1024)+    trust @memset(counts, 0, 1024)     val j: mut usize = 0     for j < count {         val cur: ref u8 = trust @ptradd(ids, (j * 32) as i64)@@ -141,33 +141,33 @@             val prev_id: ref u8 = trust @ptradd(ids, ((j - 1) * 32) as i64)             val c: i64 = compare_id(prev_id, cur)             if c == 0 {-                trust @free(counts as ref void)+                trust @free(counts)                 return err derr.fail(derr.ErrorKind.Duplicate, 1032 + j * 32)             }             if c > 0 {-                trust @free(counts as ref void)+                trust @free(counts)                 return err derr.fail(derr.ErrorKind.Unsorted, 1032 + j * 32)             }         }         val first: u8 = trust @load8(cur)-        val slot: ref u32 = trust @ptradd(counts as ref void, (first as i64) * 4) as ref u32+        val slot: ref u32 = trust @ptradd(counts, (first as i64) * 4) as ref u32         val c0: u32 = @load32(slot) as u32         @store32(slot, (c0 + 1) as i32)-        j = j + 1+        j++     }     val running: mut u32 = 0     val k: mut usize = 0     for k < 256 {-        val slot2: ref u32 = trust @ptradd(counts as ref void, (k as i64) * 4) as ref u32+        val slot2: ref u32 = trust @ptradd(counts, (k as i64) * 4) as ref u32         running = running + (@load32(slot2) as u32)         val stored: u32 = trust (@load32(@ptradd(data.ptr, (8 + k * 4) as i64)) as u32)         if stored != running {-            trust @free(counts as ref void)+            trust @free(counts)             return err derr.fail(derr.ErrorKind.Corrupt, 8 + k * 4)         }-        k = k + 1+        k++     }-    trust @free(counts as ref void)+    trust @free(counts)      val idx: mut ref Index = @alloc(@sizeof(Index)) as ref Index     idx.data = data@@ -183,10 +183,10 @@         trailer_len: pack_trailer.len == 32     }     val counts: ref u32 = @alloc(1024) as ref u32-    trust @memset(counts as ref void, 0, 1024)+    trust @memset(counts, 0, 1024)     for r in recs {         val first: u8 = trust @load8(r.id.ptr)-        val slot: ref u32 = trust @ptradd(counts as ref void, (first as i64) * 4) as ref u32+        val slot: ref u32 = trust @ptradd(counts, (first as i64) * 4) as ref u32         val c0: u32 = @load32(slot) as u32         @store32(slot, (c0 + 1) as i32)     }@@ -197,10 +197,10 @@     val running: mut u32 = 0     val k: mut usize = 0     for k < 256 {-        val slot2: ref u32 = trust @ptradd(counts as ref void, (k as i64) * 4) as ref u32+        val slot2: ref u32 = trust @ptradd(counts, (k as i64) * 4) as ref u32         running = running + (@load32(slot2) as u32)         buf.Buf.put_u32_le(b, running)-        k = k + 1+        k++     }     for r in recs {         buf.Buf.put_id(b, r.id.ptr)@@ -213,8 +213,8 @@     val digest: ref u8 = @alloc(32) as ref u8     trust b3.hash(b.ptr, b.len, digest)     buf.Buf.put_raw(b, digest, 32)-    trust @free(digest as ref void)-    trust @free(counts as ref void)+    trust @free(digest)+    trust @free(counts)      val out: bytes.Bytes = bytes.Bytes.dup(buf.Buf.view(b))     buf.Buf.free(b)--- a/src/src/store/layout.sx+++ b/src/src/store/layout.sx@@ -63,10 +63,10 @@             if c == 47 {                 break             }-            last = last - 1+            last--         }         if last <= 0 {-            val p: mut ref void = cpath as ref void+            val p: mut ref u8 = cpath             trust @free(p)             return none         }--- a/src/src/store/pack.sx+++ b/src/src/store/pack.sx@@ -124,7 +124,7 @@     trust @free(p.stored_lens as ref void)     trust @free(p.data_offs as ref void)     trust @free(p.rec_offs as ref void)-    val q: mut ref void = p as ref void+    val q: mut ref Pack = p     trust @free(q) } @@ -162,7 +162,7 @@     val digest: ref u8 = @alloc(32) as ref u8     b3.hash(data.ptr, body_end, digest)     val valid: bool = bytes.Bytes.eql(bytes.bytes(digest, 32), trailer)-    @free(digest as ref void)+    @free(digest)     if !valid {         return err derr.fail(derr.ErrorKind.HashMismatch, body_end)     }@@ -185,7 +185,7 @@     for i < count {         val rec_off: usize = reader.Reader.offset(r)         val idp: ref u8 = reader.Reader.read_id(r)?-        @memcpy(@ptradd(ids, (i * 32) as i64), idp as ref void, 32)+        @memcpy(@ptradd(ids, (i * 32) as i64), idp, 32)         @store64(@ptradd(rec_offs, (i * 8) as i64), rec_off as u64)          val kind: u8 = reader.Reader.read_u8(r)?@@ -217,7 +217,7 @@         @store64(@ptradd(stored_lens, (i * 8) as i64), stored_len)         @store64(@ptradd(data_offs, (i * 8) as i64), reader.Reader.offset(r) as u64)         val _ = reader.Reader.read_raw(r, stored_len as usize)?-        i = i + 1+        i++     }     if reader.Reader.offset(r) != body_end {         return err derr.fail(derr.ErrorKind.TrailingBytes, reader.Reader.offset(r))@@ -250,7 +250,7 @@     val stored: bytes.Bytes = Pack.stored(p, i)     if comp == 0 {         val out: ref u8 = @alloc(raw_len) as ref u8-        trust @memcpy(out as ref void, stored.ptr as ref void, raw_len)+        trust @memcpy(out, stored.ptr as ref void, raw_len)         return ok bytes.bytes(out, raw_len)     }     val decoded = zstd.decompress(stored, raw_len)@@ -322,7 +322,7 @@     val digest: ref u8 = @alloc(32) as ref u8     trust b3.hash(b.ptr, b.len, digest)     buf.Buf.put_raw(b, digest, 32)-    trust @free(digest as ref void)+    trust @free(digest)      val pack_bytes: bytes.Bytes = bytes.Bytes.dup(buf.Buf.view(b))     val pack_trailer: bytes.Bytes = bytes.Bytes.slice(--- a/src/src/store/records.sx+++ b/src/src/store/records.sx@@ -61,11 +61,11 @@             if objid.Id.cmp(rj.id, rmin.id) < 0 {                 min = j             }-            j = j + 1+            j++         }         if min != i {             swap(at(records, i), at(records, min))         }-        i = i + 1+        i++     } }--- a/src/src/store/store.sx+++ b/src/src/store/store.sx@@ -54,7 +54,7 @@         pack.free_pack(h.pack)         index.free_index(h.idx)         files.free_path(h.path)-        val p: mut ref void = h as ref void+        val p: mut ref Handle = h         trust @free(p)     }     @listfree(handles)@@ -98,7 +98,7 @@                 return true             }         }-        i = i + 1+        i++     }     return false }@@ -293,7 +293,7 @@         if bytes.Bytes.eql(bytes.Bytes.slice(hay, i, i + needle.len), needle) {             return true         }-        i = i + 1+        i++     }     return false }--- a/src/src/store/zstd.sx+++ b/src/src/store/zstd.sx@@ -38,7 +38,7 @@     }     val dst: ref u8 = @alloc(bound) as ref u8     val n: usize = trust ZSTD_compress(-        dst as ref void,+        dst,         bound,         src.ptr as ref void,         src.len,@@ -45,7 +45,7 @@         level     )     if trust ZSTD_isError(n) != 0 || n >= src.len {-        trust @free(dst as ref void)+        trust @free(dst)         return bytes.empty()     }     return bytes.bytes(dst, n)@@ -59,13 +59,13 @@     }     val dst: ref u8 = @alloc(raw_len) as ref u8     val n: usize = trust ZSTD_decompress(-        dst as ref void,+        dst,         raw_len,         src.ptr as ref void,         src.len     )     if trust ZSTD_isError(n) != 0 || n != raw_len {-        trust @free(dst as ref void)+        trust @free(dst)         return none     }     return some bytes.bytes(dst, raw_len)