Resolve dot-qualified builtin class methods in baml describe#3695
Resolve dot-qualified builtin class methods in baml describe#3695ATX24 wants to merge 2 commits into
Conversation
Co-authored-by: Dhilan Shah <[email protected]>
Co-authored-by: Dhilan Shah <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
Binary size checks passed✅ 7 passed
Generated by |
Pull Request Template
Thanks for taking the time to fill out this pull request!
Issue Reference
Please link to any related issues
Changes
Please describe the changes proposed in this pull request
The error
Given a minimal project:
Before this change, the natural method lookup failed:
The command exited with code 4 even though
reduceis a builtin instance method onArray.Root cause
baml_language/crates/baml_cli/src/describe_command.rs::dispatchhandled explicit builtin package paths (baml.Array.reduce), lowercase primitive aliases (string.length), keywords,root.*, and user-package structural paths. For an unqualified builtin class member likeArray.reduce, user-package resolution returnedNone, then the CLI fell back to substring describe with the whole stringArray.reduceas an opaque symbol name. That fallback never reachesdescribe_item_member, so it printedNo symbol found.Once
Array.reduceresolved,baml_language/crates/baml_lsp2_actions/src/describe.rs::render_method_signaturealso needed to include method-level generic parameters fromFunction::generic_params; otherwise generic builtin methods documented their callback types without the<A, E>surface.The fix
describe_command::dispatchafter user-package resolution fails. It recognizesClass.method, searches non-user packages for a unique builtin class with that short name, and returnsResolvedTarget::Memberso the existing class-method renderer is used.Class.methodstructural target still resolves before builtin fallback.Array.reduceandString.splitwithout thebaml.package prefix.Verification
Same reproduction after the change:
Commands run:
I also attempted unexcluded
cargo test --lib; it is blocked in this environment bybridge_nodejstest-linking against Node N-API symbols while the installed mise Node reportsnode_shared=falseand provides nolibnode.so.Testing
Please describe how you tested these changes
Screenshots
If applicable, add screenshots to help explain your changes
Not applicable.
PR Checklist
Please ensure you've completed these items
Additional Notes
Add any other context about the PR here
The setup required
pnpm install,pnpm --filter @boundaryml/baml-core-node build:debug, andCI=1 ./setup.shunderbaml_language/sdk_tests/crates/typescript_nodeso the TypeScript SDK harness fixtures had their generatednode_modulestrees.