Fix stack trace frame names to show enclosing function instead of callee#652
Open
stephenamar-db wants to merge 1 commit intomasterfrom
Open
Fix stack trace frame names to show enclosing function instead of callee#652stephenamar-db wants to merge 1 commit intomasterfrom
stephenamar-db wants to merge 1 commit intomasterfrom
Conversation
Stack traces previously labeled each frame with the name of the function being called at that position, rather than the function containing that position. This made traces confusing, especially for cross-file max-stack errors where the frame name didn't match the file shown. Rework formatError to scan frames from outermost to innermost, computing the enclosing function scope for each position. Builtin calls (std.*), comprehensions, and default parameter evaluations are transparent and don't create new scopes. Consecutive same-scope frames are deduplicated. Add regression test for cross-file max-stack-frames error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Error.formatErrorto label each stack frame with the enclosing function (the function whose body contains that position) instead of the callee (the function being called). This matches the convention used by Java/Python stack traces.std.*), comprehensions, and default parameter evaluations are transparent and don't create new scopes. Consecutive same-scope frames are deduplicated.error.max_stack_cross_file).Before
After
Each
[name]now reflects the function you are in, not the function you called.Test plan
error.max_stack_cross_filecovering cross-file recursive max-stack error