argotorg / argotorg/solidity

Inheritance specifiers and modifier invocations don't parse named call arguments

Open
#14,764 0 comments 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

As per [the grammar](https://docs.soliditylang.org/en/latest/grammar.html), [`inheritance-specifier`](https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.inheritanceSpecifier)s optionally accept a [`call-argument-list`](https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.callArgumentList) which is either a comma-separated list of expressions or a braced `identifier: expression` list. The latter is not accepted by Solc.

The same can be applied to [`modifier-invocation`](https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.modifierInvocation)s.

## Environment

- Compiler version: 0.8.23+commit.f704f362.Linux.g++
- Target EVM version (as per compiler settings): Shanghai
- Framework/IDE (e.g. Truffle or Remix): N/A
- EVM execution environment / backend / blockchain client: N/A
- Operating system: Linux

## Steps to Reproduce

```solidity
contract InheritMe {
constructor (uint a, bool b) {}
}

contract C is InheritMe({a: 0, b: true}) {}
```

```shell
$ solc a.sol
Error: Expected primary expression.
--> a.sol:5:25:
|
5 | contract C is InheritMe({a: 0, b: true}) {}
| ^
```

---

```solidity
contract C {
modifier mod(uint a, bool b) {
_;
}

function f() public pure mod({a: 0, b: true}) {}
}
```

```shell
$ solc b.sol
Error: Expected primary expression.
--> b.sol:6:31:
|
6 | function f() public pure mod({a: 0, b: true}) {}
| ^
```

Contributor guide

Open the contributing guide

Research direction

Run solc on the two Solidity snippets to reproduce the parser errors, then compare the grammar entries for inheritanceSpecifier, modifierInvocation, and callArgumentList linked in the issue. Done means both inheritance specifiers and modifier invocations accept braced named arguments without the reported parsing errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.