argotorg / argotorg/solidity

`pathDeclarations` annotation on `IdentifierPath` AST node is not exported

Open
#13,582 0 comments 0 reactions 0 assignees View on GitHub
bug :bug: low effort low impact must have eventually
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

We do not export the [`pathDeclarations`](https://github.com/ethereum/solidity/blob/v0.8.17/libsolidity/ast/ASTAnnotations.h#L261) annotation. This means that when we export and re-import the AST it loses its value.

Compiler version: 0.8.17

### Example
```solidity
contract C {
modifier m { _; }
constructor() C.m() {}
}
```
The relevant part of `solc --ast-compact-json` output:
```json
"modifiers":
[
{
"arguments": [],
"id": 7,
"kind": "modifierInvocation",
"modifierName":
{
"id": 6,
"name": "C.m",
"nameLocations":
[
"53:1:0",
"55:1:0"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 4,
"src": "53:3:0"
},
"nodeType": "ModifierInvocation",
"src": "53:5:0"
}
],
```

Contributor guide

Open the contributing guide

Research direction

Start with the pathDeclarations annotation in libsolidity/ast/ASTAnnotations.h and trace the AST export path for IdentifierPath nodes. Reproduce the example with solc --ast-compact-json, then verify that exporting and re-importing the AST preserves pathDeclarations in the relevant JSON output.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.