diem/move

[move-to-yul] bug in string literal

Closed this issue · 1 comments

When the same string literal "error_message" is used twice in the function like:

    public fun safeTransferFrom(from: address, to: address, id: U256, amount: U256, _data: vector<u8>) acquires State {
        require(from == sender() || isApprovedForAll(from, sender()), b"error_message");
        let s = borrow_global_mut<State>(self());
        let mut_balance_from = mut_balanceOf(s, copy id, from);
        require(U256::le(copy amount, *mut_balance_from), b"error_message");

move-to-yul raises the following error.

Error: Variable name $offs_3855568786 already taken in this scope.
   --> <stdin>:943:25:
    |
943 |                         let $offs_3855568786 := add($t19, 32)
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

fixed in the move-language/move repo: move-language/move#1