Preserve names of runtime interpreted functions and classes - #11008
proggeramlug wants to merge 2 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe interpreter now assigns declared names to named functions and classes created from runtime-generated ChangesDynamic function and class names
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change exposes declared names on dynamically created functions and classes, with no concrete production failure identified; it is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings
🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
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 |
|
Landed on main in merge train 257 (#11039, v0.5.1640), main Carried at head This train was split by blast radius after an earlier 35-PR assembly hit five gap regressions: it carries only PRs touching no lowering path. Trains rebase-merge, so commits get new SHAs and GitHub cannot mark this merged. Closed as landed. |
Summary
Preserve
.nameon named function declarations, function expressions, and class expressions evaluated by the runtimenew Functioninterpreter. The interpreter already retained the parsed name for lexical self references, but it never installed the name on the returned closure.Use the existing closure name setter after allocation while the closure is rooted. Literal source and the outer
Functionconstructor keep their existing names.Fixes #10676.
Testing
FUNCTION Literaland an emptyCLASSname; the patched build printsFUNCTION Literal Named,CLASS Widget, andCONSTRUCTOR anonymous.cargo test -p perry-runtime --lib interpreted_functions_and_classes_keep_their_declared_namescargo test -p perry --test issue_10676_dynamic_function_namescargo fmt --all -- --check,git diff --check, andscripts/check_file_size.shSummary by CodeRabbit
Bug Fixes
.nameproperty for named functions and classes created at runtime, including dynamically assembled sources.Tests