-- haxe-parity Task 4, fix round 1 (review Critical 1): a payload -- binding ESCAPING its arm as the switch's value is a MOVE OUT of the -- variant object. Three shapes, all ASan-verified: -- 1. local subject (`v`): the escape arm nulls the shell's field, so -- `v`'s own scope-end drop frees the shell only — `out` owns the -- payload; without the null this exact shape double-freed -- (reviewer-reproduced, plain wovm rc=139); -- 2. borrowed-param subject (`get`'s `ev`): the payload moves out -- through the borrow and returns to the caller; -- 3. the caller's OWNED VARIANT TEMPORARY argument (`get(Boxed(..))`) -- is reaped by the caller after the call — before this fix the -- shell leaked ~30 B per iteration (reviewer's h5 probe: maxrss -- 10,508 KB vs a 1,532 KB control over 300k iterations). -- `Big` is 130 Int fields: past the arena's 1024-byte ceiling, so any -- miss is a hard ASan failure. Defaults keep the literals short. type Ev = Tick | Boxed(b: Big) class Big { f0: Int = 1 f1: Int = 1 f2: Int = 1 f3: Int = 1 f4: Int = 1 f5: Int = 1 f6: Int = 1 f7: Int = 1 f8: Int = 1 f9: Int = 1 f10: Int = 1 f11: Int = 1 f12: Int = 1 f13: Int = 1 f14: Int = 1 f15: Int = 1 f16: Int = 1 f17: Int = 1 f18: Int = 1 f19: Int = 1 f20: Int = 1 f21: Int = 1 f22: Int = 1 f23: Int = 1 f24: Int = 1 f25: Int = 1 f26: Int = 1 f27: Int = 1 f28: Int = 1 f29: Int = 1 f30: Int = 1 f31: Int = 1 f32: Int = 1 f33: Int = 1 f34: Int = 1 f35: Int = 1 f36: Int = 1 f37: Int = 1 f38: Int = 1 f39: Int = 1 f40: Int = 1 f41: Int = 1 f42: Int = 1 f43: Int = 1 f44: Int = 1 f45: Int = 1 f46: Int = 1 f47: Int = 1 f48: Int = 1 f49: Int = 1 f50: Int = 1 f51: Int = 1 f52: Int = 1 f53: Int = 1 f54: Int = 1 f55: Int = 1 f56: Int = 1 f57: Int = 1 f58: Int = 1 f59: Int = 1 f60: Int = 1 f61: Int = 1 f62: Int = 1 f63: Int = 1 f64: Int = 1 f65: Int = 1 f66: Int = 1 f67: Int = 1 f68: Int = 1 f69: Int = 1 f70: Int = 1 f71: Int = 1 f72: Int = 1 f73: Int = 1 f74: Int = 1 f75: Int = 1 f76: Int = 1 f77: Int = 1 f78: Int = 1 f79: Int = 1 f80: Int = 1 f81: Int = 1 f82: Int = 1 f83: Int = 1 f84: Int = 1 f85: Int = 1 f86: Int = 1 f87: Int = 1 f88: Int = 1 f89: Int = 1 f90: Int = 1 f91: Int = 1 f92: Int = 1 f93: Int = 1 f94: Int = 1 f95: Int = 1 f96: Int = 1 f97: Int = 1 f98: Int = 1 f99: Int = 1 f100: Int = 1 f101: Int = 1 f102: Int = 1 f103: Int = 1 f104: Int = 1 f105: Int = 1 f106: Int = 1 f107: Int = 1 f108: Int = 1 f109: Int = 1 f110: Int = 1 f111: Int = 1 f112: Int = 1 f113: Int = 1 f114: Int = 1 f115: Int = 1 f116: Int = 1 f117: Int = 1 f118: Int = 1 f119: Int = 1 f120: Int = 1 f121: Int = 1 f122: Int = 1 f123: Int = 1 f124: Int = 1 f125: Int = 1 f126: Int = 1 f127: Int = 1 f128: Int = 1 f129: Int = 1 } fn get(ev: Ev) -> Big { return switch ev { case Boxed(b): b; case Tick: Big {}; } } fn main() -> Int { let v = Boxed(Big {}) let out = switch v { case Tick: Big {}; case Boxed(b): b; } print_int(out.f0) let i = 0 let acc = 0 while i < 50 { let x = get(Boxed(Big {})) acc = acc + x.f0 i = i + 1 } print_int(acc) return 0 }