Skip to content

Stop a property name shadowing the codec's argument - #17

Merged
Jack97 merged 1 commit into
masterfrom
jr/codec-argument-shadowing
Sep 14, 2026
Merged

Jack97 merged 1 commit into
masterfrom
jr/codec-argument-shadowing

Conversation

@Jack97

@Jack97 Jack97 commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

A document with a property named value generated value = value.value inside to_wire, rebinding the struct the method was given — every property after it then raised NoMethodError. A property named wire clobbered the accumulator hash.

Found in nexus-api's MonthlyReportEntry, which next consumes.

The locals are fixed names now. The adversarial fixture grew value, wire, inner and a trailing property so the golden tree locks it in.

`to_wire` read each property into a local named after it, so a document
with a property called `value` emitted `value = value.value`, rebinding
the struct the method was given. Every property after it then read off
an Optional and raised NoMethodError. A property called `wire` clobbered
the accumulator the same way.

The locals are fixed names now, so no property can reach them.
@Jack97
Jack97 force-pushed the jr/codec-argument-shadowing branch from f35517a to a944060 Compare September 14, 2026 15:28
@Jack97
Jack97 merged commit 067d8c7 into master Sep 14, 2026
10 checks passed
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.

1 participant