Skip to content

Fix eval -x of local members - #1760

Merged
bioball merged 3 commits into
apple:mainfrom
bioball:eval-x-locals
Jul 11, 2026
Merged

Fix eval -x of local members#1760
bioball merged 3 commits into
apple:mainfrom
bioball:eval-x-locals

Conversation

@bioball

@bioball bioball commented Jul 10, 2026

Copy link
Copy Markdown
Member

This fixes a regression where local members cannot be seen by the expression evaluator.

Because variable are now parse-time resolved, this builds a truffle node by first constructing a synthetic module of all defined local members, and calls AstBuilder on this synthetic module first.

This moves some existing logic from ReplServer over to VmUtils.

Closes #1759

This fixes a regression where local members cannot be seen by the
expression evaluator.

Because variable are now parse-time resolved, this builds a truffle node
by first constructing a synthetic module of all defined local members,
and calls AstBuilder on this synthetic module first.

@HT154 HT154 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bioball
bioball enabled auto-merge (squash) July 10, 2026 23:51
@bioball
bioball merged commit 60b0d86 into apple:main Jul 11, 2026
21 checks passed
bioball added a commit that referenced this pull request Jul 11, 2026
This fixes a regression where local members cannot be seen by the
expression evaluator.

Because variable are now parse-time resolved, this builds a truffle node
by first constructing a synthetic module of all defined local members,
and calls AstBuilder on this synthetic module first.
@bioball
bioball deleted the eval-x-locals branch July 12, 2026 12:57
protobufel2 added a commit to protobufel2/pkl that referenced this pull request Jul 24, 2026
PR apple#1760 prepends a fixed-length preamble to expression input and
compensates for it in StackTraceRenderer.renderSourceLine. That
compensation subtracted the preamble length from endColumn
unconditionally, but for a frame spanning multiple lines endColumn is
sourceLine.length(), measured on the already-preamble-stripped line.
The preamble was therefore subtracted twice, driving endColumn
negative and making the caret-width String.repeat call throw
IllegalArgumentException instead of rendering the error.

Fold the preamble offset into the frame-derived column values, which
are in original coordinates, and leave the stripped-length branch
untouched. Same-line frames are unaffected.
protobufel2 added a commit to protobufel2/pkl that referenced this pull request Jul 24, 2026
PR apple#1760 prepends a fixed-length preamble to expression input and
compensates for it in StackTraceRenderer.renderSourceLine. That
compensation subtracted the preamble length from endColumn
unconditionally, but for a frame spanning multiple lines endColumn is
sourceLine.length(), measured on the already-preamble-stripped line.
The preamble was therefore subtracted twice, driving endColumn
negative and making the caret-width String.repeat call throw
IllegalArgumentException instead of rendering the error.

Fold the preamble offset into the frame-derived column values, which
are in original coordinates, and leave the stripped-length branch
untouched. Same-line frames are unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eval -x cannot find local properties

2 participants