Remove the disabled >>>
(SHR) operator
#15839
Labels
low effort
There is not much implementation work to be done. The task is very easy or tiny.
low impact
Changes are not very noticeable or potential benefits are limited.
should have
We like the idea but it’s not important enough to be a part of the roadmap.
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:solidity/libsolidity/ast/Types.cpp
Lines 576 to 578 in 9ff6d26
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 theconstantinople
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).
The text was updated successfully, but these errors were encountered: