Skip to content

Remove the disabled >>> (SHR) operator #15839

Open
@cameel

Description

@cameel

Solidity parser accepts >>> and >>>= as valid operators. They're also present in the grammar. Looks like they have been present ever since the shift operators were introduced (#1487). They are, however, not documented and seem to be deliberately disabled:

// Disable >>> here.
if (_operator == Token::SHR)
return false;

The operators seem to have been meant to handle unsigned right shift (SHR), as opposed to >>, which performs a signed right shift (SAR). Note that both were introduced at the same time, in the constantinople EVM.

It's been a long time (>9 years) since the shift operators were added and I don't remember anyone actually requesting them or reporting them as broken so we should probably just remove this bit of legacy. But enabling and properly documenting them would not hurt either.

For the time being it would also be clearer to reject them with a proper error message (disabled? unimplemented? dangerous?) rather than make them incompatible with all types, which must be very confusing to anyone who encounters them (it was for me).

Metadata

Metadata

Assignees

No one assigned

    Labels

    low effortThere is not much implementation work to be done. The task is very easy or tiny.low impactChanges are not very noticeable or potential benefits are limited.should haveWe like the idea but it’s not important enough to be a part of the roadmap.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions