argotorg / argotorg/solidity

Getting Yul ASTs requires asking for ast at contract level instead of at file level

Open
#14,452 2 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

## Description

When compiling in Yul mode, including `"ast"` in the file-level output selection doesn't result in getting ASTs like it does when compiling Solidity. Instead you have to set it at the contract level. This makes no sense, because ASTs are a file-level matter, and is also inconsistent with how the compiler acts when compiling Solidity.

## Environment

- Compiler version: 0.8.21
- Target EVM version (as per compiler settings): default

## Steps to Reproduce

Really any Yul code will do here! What's relevant here is the output selection. An `outputSelection` of

```
{
"*": {
"": ["ast"],
"*": [
"evm.bytecode.object"
]
}
}
```

won't get the AST,

whereas one of

```

{
"*": {
"": [],
"*": [
"ast",
"evm.bytecode.object"
]
}
}
```

will.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the two outputSelection examples and a minimal Yul input. Trace how the compiler handles file-level and contract-level AST requests in Yul versus Solidity; done means the file-level "ast" selection produces the Yul AST consistently with Solidity.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.