`payable` typecast has incorrect byte length in AST
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
## Description
As stated in the title. Reproducible even with the latest solc version (0.8.30).
`byte_length` should be 7 instead of 8.
```
node_type='ElementaryTypeNameExpression' src=Src(byte_offset=1494, byte_length=8, file_id=7) id=504 is_constant=False
is_l_value=False is_pure=True l_value_requested=False
type_descriptions=TypeDescriptionsModel(type_identifier='t_type$_t_address_payable_$', type_string='type(address payable)')
type_name=SolcElementaryTypeName(node_type='ElementaryTypeName', src=Src(byte_offset=1494, byte_length=8, file_id=7),
id=503, type_descriptions=TypeDescriptionsModel(type_identifier=None, type_string=None), name='address',
state_mutability=) argument_types=[TypeDescriptionsModel(type_identifier='t_address',
type_string='address')]
```
## Environment
- Compiler version: 0.8.30
- Compilation pipeline (legacy, IR, EOF): legacy
- Target EVM version (as per compiler settings): default
- Framework/IDE (e.g. Foundry, Hardhat, Remix):
- EVM execution environment / backend / blockchain client:
- Operating system:
## Steps to Reproduce
Reproducible in [Safe](https://github.com/safe-global/safe-smart-account/blob/b115c4c5fe23dca6aefeeccc73d312ddd23322c2/contracts/libraries/SignMessageLib.sol#L35), for example.
Contributor guide
Research direction
Reproduce the AST output using the Safe contracts/libraries/SignMessageLib.sol example with Solidity 0.8.30 and the legacy pipeline. Inspect the ElementaryTypeNameExpression source range for the payable typecast; done means its byte_length is reported as 7 rather than 8.
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