Skip to content

fixes #21807; initialize nested JS refs with the correct representation - #26895

Open
jasagiri wants to merge 1 commit into
nim-lang:develfrom
jasagiri:fix-21807
Open

jasagiri wants to merge 1 commit into
nim-lang:develfrom
jasagiri:fix-21807

Conversation

@jasagiri

@jasagiri jasagiri commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

new failed for a ref to a ref object on the JS backend: the generated code treated the object as null and then wrote through it. In genNew, skipTypes already provided the element type for allocation, but mapType was also given only that element type. The JS backend needs the full reference type to select the correct object representation.

Pass the complete refType to mapType, while continuing to use its element type for allocation. tests/js/t21807.nim checks allocation and field initialization, as well as the nested primitive-ref case from the report.

🤖 Generated with Claude Code

…esentation

Select the JS allocation path from the allocated reference type while retaining the pointee type for default initialization. The regression fails on the original compiler with a null write and passes after the fix.
Fixes nim-lang#21807

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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