argotorg / argotorg/solidity

Reconsider operators on ContractType

Open
#11,700 14 comments 0 reactions 0 assignees View on GitHub
breaking change :warning: language design :rage4: medium effort medium impact needs design
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.