fix(codegen): preserve renamed namespace constructor args - #9296
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe compiler now preserves origin class metadata and resolves renamed namespace re-exports through collision-free registry keys, allowing constructor arguments and parameter properties to initialize correctly. ChangesRenamed namespace class resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Renamed namespace constructors now forward arguments correctly while non-class namespace members retain their existing behavior; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description includes the required Summary, Changes, Related issue, Test plan, Screenshots/output, and Checklist sections. It documents the implementation, targeted verification, regression behavior, and unchecked full-suite commands. Full details: Linked Issues checkExplanation The changes satisfy issue Full details: Out of Scope Changes checkExplanation The changes are within scope for issue Full details: Docstring CoverageExplanation Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Audited the diff — root-cause fix on both sides, and it explains the symptom exactly. I'd merge. The reported failure was odd in a specific way: Codegen side. Pipeline side. The registration path had the same origin-vs-alias mismatch, and the comment names the consequence precisely:
That is the missing half of the explanation. A function wrapper still satisfies Fixing the lookup key and the registration is the right scope: fixing only one would leave the other resolving a different entity for the same source expression. Small noteThe two fallback blocks in |
Summary
Restore constructor argument forwarding for classes reached as
new ns.VisibleAlias(...)through a renamed re-export. The namespace import now keeps the class's origin metadata under its visible scoped key, and static class resolution consumes that collision-free key instead of falling through to a function wrapper.Changes
newthrough the scoped(namespace, member)class entry introduced by fix(compile): support full OpenCode source builds #9133.Related issue
Fixes #9285
Test plan
Run on
root@perrymaster.skelpo.netwith coherent compiler/runtime archives:./scripts/pre-tag-check.sh --quickcargo build -p perry -p perry-runtime-static -p perry-stdlib-staticPERRY_NO_AUTO_OPTIMIZE=1 RUST_TEST_THREADS=1 cargo test -p perry --test functional_batch2_regressions imported_class_namespace_reexport_uses_visible_alias --quietcargo test -p perry-codegen --lib --quiet(1,378 passed; 1 ignored)PERRY_NO_AUTO_OPTIMIZE=1 RUST_TEST_THREADS=1 cargo test -p perry --test functional_batch2_regressions --quiet(7 passed)PERRY_NO_AUTO_OPTIMIZE=1 RUST_TEST_THREADS=1 cargo test -p perry --test issue_5437_cross_module_member_new_capture --quiet(1 passed)PERRY_NO_AUTO_OPTIMIZE=1 RUST_TEST_THREADS=1 cargo test -p perry --test module_import_forms --quiet(6 passed)The issue fixture was also compiled with
--trace llvm: before the fix it calledjs_new_function_construct; after the fix it directly callsmodel_ts__Child_constructorwith the user argument.cargo build --releasecleancargo test --workspace --exclude perry-ui-ios --exclude perry-ui-tvos --exclude perry-ui-watchos --exclude perry-ui-gtk4 --exclude perry-ui-android --exclude perry-ui-windowspassesdocs/src/-p perry-ui-<backend>locally on that platformScreenshots / output
Before:
After:
Checklist
feat:/fix:/docs:/chore:prefix convention used in the logSummary by CodeRabbit