Reconsider operators on ContractType
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
```solidity
contract Test {}
contract Derived is Test {}
function f(Test a, Test b) {
a < b;
a == b;
a > b;
a <= b;
a >= b;
}
function g(Derived a, Test b) {
a < b;
a == b;
a > b;
a <= b;
a >= b;
}
```
Currently, the above code compiles. I think the comparison operators does not belong with the ContractType. Even the equality operator is questionable. Disallowing all these operators is especially important to be consistent with how operators are disallowed by default in user defined types: https://github.com/ethereum/solidity/issues/11531.
Contributor guide
Research direction
Start by reproducing the Solidity snippets in the issue with the compiler, then read the linked issue #11531 for the related user-defined-type operator rules. The work is done when the accepted operators for ContractType are decided, implemented consistently, and covered by tests for both same-type and derived/base comparisons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100