Allow overloading of custom errors
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
## Abstract
Allow custom error with the same name, but different parameter, to be declared
## Motivation
According to [this blog post](https://blog.soliditylang.org/2021/04/21/custom-errors/), custom errors are encode similarly to function call.
> The error data would be encoded identically as the ABI encoding for function calls, i.e.,
> `abi.encodeWithSignature("InsufficientBalance(uint256,uint256)", balance[msg.sender], amount)`.
However, declaring
```
error InsufficientBalance(address owner); // for ERC20
error InsufficientBalance(address owner, uint256 tokenId); // for ERC1155
```
result in an error `DeclarationError: Identifier already declared`.
This should be allowed IMO.
## Backwards Compatibility
N/A
Contributor guide
Research direction
No source files, tests, or compiler entry points are named in the issue. Start by locating the handling of custom-error declarations and duplicate identifiers, then find tests covering error declarations; done means same-name custom errors with distinct parameter lists are accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100