//check: VerificationError { kind: FunctionDefinition, idx: 2, err: CallTypeMismatchError(4) } module Token { resource T{value: u64} public new(m: u64): R#Self.T { return T{value: copy(m)}; } public destroy(t: R#Self.T) { let value: u64; T {value} = move(t); return; } public read_value(this: &R#Self.T): u64 { let val: &u64; val = ©(this).value; Self.bump_value(move(this)); return *move(val); } public bump_value(this: &mut R#Self.T) { let val: &mut u64; let x: u64; val = &mut move(this).value; x = *copy(val) + 1; *move(val) = copy(x); return; } } //! new-transaction import {{default}}.Token; main() { let t: R#Token.T; let i: u64; t = Token.new(42); i = Token.read_value(&t); Token.destroy(move(t)); return; }