Skip to content

Incorrect formatting of [msg.sender] #205

@josojo

Description

@josojo

Hello,

After running prettier on the following code:

contract Example {
    using SafeMath for uint256;
    
    struct BalanceState {
        uint256 balance;
    }

    mapping(address => mapping(address => BalanceState)) private balanceStates;
    function example(address token, uint amount) public {
        balanceStates[msg.sender][token].balance = balanceStates[msg.sender][token].balance.sub(amount);
    }
}

I get:

contract Example {
    using SafeMath for uint256;

    struct BalanceState {
        uint256 balance;
    }

    mapping(address => mapping(address => BalanceState)) private balanceStates;
    function example(address token, uint256 amount) public {
        balanceStates[msg.sender][token].balance = balanceStates[msg
            .sender][token]
            .balance
            .sub(amount);
    }
}

The formating of msg.sender is obviously incorrect.

I provided this minimal example over here in a repository, so that it is easy to reproduce:

https://github.com/josojo/prettier-bug-description

A fix would be awesome! Prettier is a great tool

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions