module Tester { struct T{v: u64} public new(v: u64): V#Self.T { return T{v: move(v)}; } public replace(t: &mut V#Self.T) { let t2: &mut V#Self.T; let t_v: &mut u64; let new_t: V#Self.T; t2 = copy(t); t_v = &mut copy(t2).v; *move(t_v) = 10000; new_t = Self.new(1); *move(t2) = move(new_t); release(move(t)); return; } public value(this: &mut V#Self.T): u64 { let ref_v: &u64; ref_v = &move(this).v; return *move(ref_v); } } //! new-transaction import {{default}}.Tester; main() { let t: V#Tester.T; let ref_t: &mut V#Tester.T; let v_from_ref: u64; let tt: &mut V#Tester.T; let v_from_t: u64; t = Tester.new(0); ref_t = &mut t; Tester.replace(copy(ref_t)); v_from_ref = Tester.value(move(ref_t)); tt = &mut t; v_from_t = Tester.value(move(tt)); assert(copy(v_from_ref) == 1, 42); assert(copy(v_from_t) == 1, 42); return; }