Skip to content

Avoid recursive root lowering in make - #67

Open
quinnj wants to merge 1 commit into
mainfrom
codex/fix-root-lowering-recursion
Open

Avoid recursive root lowering in make#67
quinnj wants to merge 1 commit into
mainfrom
codex/fix-root-lowering-recursion

Conversation

@quinnj

@quinnj quinnj commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Limit automatic root lowering to sources for which structlike(style, source) is false.
  • Preserve the @nonstruct root mapping added by Fix root lowering for non-struct mappings #64.
  • Allow struct-like lower methods to call make for field traversal without recursion.
  • Document the root-lowering contract and add nested regression coverage.

Root cause

PR #64 made the generic structural make path call lower for every root source. A struct-like lower method implemented with make therefore entered a direct make -> lower -> make cycle.

The fix keeps root representation lowering for non-struct sources, which is the case required by #29, while traversing ordinary struct roots directly. applyeach continues to lower nested values.

Validation

  • Julia 1.9.4: full package suite passed, 255 tests.
  • Julia 1.12.6: full package suite passed, 255 tests.
  • Julia 1.12.6: JuliaC trim suite passed, 7 checks.
  • Julia 1.13.0-rc1: full package suite passed, 255 tests.
  • Documenter build and doctests passed.
  • Focused four-field struct-to-dictionary check retained 576 bytes per call and showed no measured slowdown.

Fixes #66

Co-authored by Codex

Lower only non-struct-like root sources before structural builders. This preserves @nonstruct representation mapping while allowing a struct-like lower method to call make for field traversal.

Add nested regression coverage and document the root-lowering contract.

Fixes #66
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.

Using StructUtils.make in a custom lower method causes a stack overflow as of v2.8.3

1 participant