-
Notifications
You must be signed in to change notification settings - Fork 679
fix(printer): map source maps to MostOriginal source to avoid out-of-range positions #1539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…p panic in printer/SkipTrivia path
…range positions during emit test(printer): add sourcemap mismatch repro exercising original-node mapping chore: remove temporary debug logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a panic during declaration map emission that occurs when source map positions reference different files or position spaces than the current file being processed. The fix ensures source maps use the original parse tree source file for position mappings instead of the current file.
Key changes:
- Modified printer source map emission functions to use
MostOriginal(node)
for selecting the correct source file - Added comprehensive test coverage for the source map mismatch scenario
- Removed temporary debug logging
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
internal/scanner/utilities.go | Removed debug comment line |
internal/scanner/scanner.go | Fixed variable scoping in GetLineAndCharacterOfPosition function |
internal/printer/utilities.go | Removed debug comment line |
internal/printer/sourcemap_mismatch_panic_test.go | Added isolated test reproducing the source map panic scenario |
internal/printer/printer.go | Updated source map emission to use original node's source file for position mappings |
internal/execute/blackbox_panic_test.go | Added blackbox test for declaration map panic with destructured parameters |
@@ -19,6 +19,7 @@ package printer | |||
|
|||
import ( | |||
"fmt" | |||
"os" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The os
import is added but not used in the visible code. This appears to be leftover debug code that should be removed.
"os" |
Copilot uses AI. Check for mistakes.
@microsoft-github-policy-service agree company="Uplinq Inc." |
This PR contains a whole lot of unrelated changes / formatting issues, and adds tests in formats we don't use for testing. I'm not sure if this is just AI generated or what, but it would need changes to be able to accept (and at least formatting to review) |
Fixes a panic during declaration map emission by mapping source-map positions against the original parse tree source.
Changes:
All tests pass locally: 9155 tests, 506 skipped.