Open cameel opened 1 week ago
Decision from the call today: we're going to disallow dots in names and we don't consider it breaking. Such names don't seem to work properly outside of weird corner cases anyway and any code broken by it can be trivially converted into working code by just removing the dots. It also only affects Yul - the Solidity compiler never generates object names with dots by itself.
@cameel Hello, I hope you're doing well. I noticed that this issue has a "low effort" label, and I would be interested in contributing. Is there a possibility that I could help with something?
I'm just starting to study Solidity, and I created a repo to track my progress: https://github.com/salvadormartin3z/Learn-Solidity any recommendations are welcome.
I hope we can connect.
Description
An identifier like
A.B.C
is a valid name for a Yul object. However, the compiler also uses dots as separators in qualified object/data names. This creates ambiguity when names with dots are passed to builtins likedataoffset()
ordatasize()
.Such names are interpreted as paths by some parts of the compiler and as names by other parts. This results in errors or ICEs unless both possibilities are defined. And when both are defined, it's possible that some checks are getting bypassed.
Environment
Steps to Reproduce
Unreferenced object
unreferenced.yul
Dots in names are accepted and apparently cause no issue on their own.
Top-level subobject
top-level.yul
:The error is coming from Yul analysis, which means that it treats it as a path and expects a nested subobject.
Nested subobject
nested.yul
:This one probably passes Yul analysis but then fails later at a place that interprets the path differently.
Ambiguous subobject
ambiguous.yul
:Note the
0x07
- when assembling we're apparently choosing the top-leveldata
, again different from analysis.