Skip to content

Compiler gives incorrect arithmetic hint for decimal division #4077

@ritzdorf

Description

@ritzdorf

Version Information

  • vyper Version (output of vyper --version OR linkable commit hash vyperlang/vyper@commitish): 0.4.0rc3+commit.80708e6d

Issue description

When encountering a decimal division / the compiler gives a hint on how the code should look. However, sometimes it gives incorrect hint, as it seems to drop important parentheses.

POC

# pragma version 0.4.0.rc3

@external
def foo(a: uint256, b:uint256, c: uint256) -> uint256:
    return (a + b) / c 

The compiler suggests:

  (hint: did you mean `a + b // c`?)

which is not correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions