Skip to content

Fix wire codec for multi-level extensible record chains#88

Open
dillonkearns wants to merge 1 commit intolamdera:lamdera-nextfrom
dillonkearns:fix/wire-two-level-extensible
Open

Fix wire codec for multi-level extensible record chains#88
dillonkearns wants to merge 1 commit intolamdera:lamdera-nextfrom
dillonkearns:fix/wire-two-level-extensible

Conversation

@dillonkearns
Copy link
Copy Markdown
Collaborator

Uncovered another wire codec issue from #87, here's a fix for it.

When an extensible record extends another extensible record (e.g. Level2 compatible = Level1 { compatible | field2 : Int }), the wire codec generator would only resolve one level of TAlias chain, silently dropping fields from the outermost extension.

When an extensible record extends another extensible record
(e.g. `Level2 compatible = Level1 { compatible | field2 : Int }`),
the wire codec generator would only resolve one level of TAlias chain,
silently dropping fields from the outermost extension.

Adds `resolveToRecord` helper in Helpers.hs that recursively peels TAlias
layers until reaching a TRecord. Applied in both Encoder and Decoder Holey
branches where `resolveTvar` previously only matched a single TAlias layer.

Test: Wire_Record_Extensible6_TwoLevel.elm with two-level and three-level
extensible chains, plus a union wrapping both.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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