Repository navigation
format: allow identifiers to start with $ - #325
Merged
Merged
Conversation
gnidan
force-pushed
the
architect-tilde-sigil
branch
from
October 5, 2026 23:15
5ada108 to
cbf1ea0
Compare
gnidan
force-pushed
the
architect-dollar-identifiers
branch
from
October 5, 2026 23:15
1201410 to
a1370ad
Compare
Contributor
|
gnidan
force-pushed
the
architect-tilde-sigil
branch
from
October 8, 2026 00:10
cbf1ea0 to
73691fa
Compare
gnidan
force-pushed
the
architect-dollar-identifiers
branch
from
October 8, 2026 00:13
a1370ad to
35441b4
Compare
gnidan
marked this pull request as ready for review
October 8, 2026 00:19
Solidity allows a name to start with $, so admit one as a pointer identifier. Now that the format's own terms use ~, a name such as $wordsize or $this is a variable or region name and cannot be read as a format term. @ethdebug/pointers resolves such names, and its hint for an old $ term moves to the failure paths where a $ name now lands: an unknown variable or a region that is not found.
gnidan
force-pushed
the
architect-dollar-identifiers
branch
from
October 8, 2026 00:29
35441b4 to
4901010
Compare
djolertrk
added a commit
to walnuthq/soldb
that referenced
this pull request
Oct 8, 2026
ethdebug/format 0.1.0-draft.2 spells its pointer expression terms with `~` instead of `$` (ethdebug/format#323) and lets identifiers start with `$` (ethdebug/format#325), and solc follows it. Read `~sum`, `~read`, `~wordsize`, `~this` and the other terms, and accept names starting with `$`, so a struct member such as `$member` is found as it is. Released compilers still write `$sum` and the like, so the `$` spelling is still read as the term wherever a name cannot be meant: as an expression key, and as `$wordsize` and `$this`, which no compiler names a variable or a region. The fixture is regenerated with the stamp and the `~` terms, and the pointer lit test accepts either spelling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solidity allows a name to start with
$, and a compiler wants to use source names as they are in pointer output (region, variable and template names). ethdebug/format/pointer/identifier now allows a leading$, so a name such as$balanceneeds no renaming. A leading~stays forbidden.This splits out from #323, which switched the format's own terms to
~. That switch removed the collision a leading$would otherwise cause, such as"$wordsize"being both a variable name and the format constant.For producers, this is optional: a name may now start with
$. bugc's names never start with$, so its output does not change. For consumers, it is required: a string that starts with$can now be a name ("$wordsize"is a variable,{ ".offset": "$this" }looks up a region named$this), so a consumer must accept the wider identifier pattern.The reference implementation follows.
Pointer.isIdentifierin@ethdebug/formataccepts a leading$, and@ethdebug/pointersresolves$names for variables, regions and templates. Its hint for an old$term moves to the failure paths where such a name now lands: an unknown variable, or a region that is not found. The Unreleased changelog entries say the same.