//# publish module 0x42.Test { struct T has drop {value: u64} initial_value(): u64 { label b0: return 42; } public new(): Self.T { let initial_value: u64; label b0: initial_value = Self.initial_value(); return T{value: move(initial_value)}; } public get_value(this: &Self.T): u64 { let x: &u64; label b0: x = ©(this).T::value; _ = move(this); return *move(x); } public set_value(this: &mut Self.T, new_value: u64) { label b0: Self.internal_set_value(move(this), move(new_value)); return; } internal_set_value(this: &mut Self.T, new_value: u64) { let x: &mut u64; label b0: x = &mut copy(this).T::value; *move(x) = move(new_value); _ = move(this); return; } } //# run import 0x42.Test; main() { let obj: Test.T; let ref: &Test.T; label b0: obj = Test.new(); ref = &obj; // calling an internal function with the wrong arguments will fail before visibility checks // are done Test.internal_set_value(move(ref), 1); return; }