// heapptr_dotread_test — chained field reads through an INFERRED alloc // pointer must go THROUGH the pointer: mutate the heap str after the // fill, then re-point the base at a second object — a read that // bypasses the pointer (stale cached addr or literal-global load) // returns the wrong len. package heapptr_dotread_test; type s1t = str; type s2t = s1t; type box = struct { s: s2t, n: int }; @test fn mutate_then_repoint() void = { let p = alloc(box { s = "hello", n = 5 })!; assert(p.s.len == 5); p.s = "worldwide"; assert(p.s.len == 9); let q = alloc(box { s = "xy", n = 7 })!; p = q; assert(p.s.len == 2); assert(p.n == 7); };