Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Conversation

@Lexxxzy
Copy link

@Lexxxzy Lexxxzy commented Sep 4, 2025

Address #497

The changes enhance scope tracking, symbol resolution, and support for Python features such as typed splat parameters, subclass initialization with keyword parameters and lambdas.

Copilot AI review requested due to automatic review settings September 4, 2025 17:47
@Lexxxzy Lexxxzy requested review from a team as code owners September 4, 2025 17:47
Copy link

Copilot AI left a 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 multiple Python Tree-sitter Stack Graphs (TSG) grammar scoping errors by improving scope tracking, symbol resolution, and support for advanced Python features. The changes address issue #497 and enhance the handling of typed splat parameters, subclass initialization with keyword parameters, and lambda expressions.

Key changes:

  • Improved lambda function scoping with separate handlers for lambdas with and without parameters
  • Enhanced parameter pattern matching to support typed splat parameters (*args and **kwargs)
  • Fixed assignment expression handling and superclass argument processing
  • Added comprehensive test cases for the new functionality

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/stack-graphs.tsg Core grammar fixes including lambda scoping, parameter patterns, and assignment handling
test/typed_splat_params.py Test case for typed splat parameter resolution
test/superclasses.py Test case for subclass initialization with keyword parameters
test/lambdas.py Extended test cases for lambda scope resolution
test/assignments.py Test case for assignment expression handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +787 to +809
(lambda
body: (_) @body
) @lam {
node @lam.call
node return_value
node @body.after_scope

edge @lam.call -> return_value
edge @body.before_scope -> @body.after_scope
edge @body.after_scope -> @lam.bottom
attr (@lam.call) pop_scoped_symbol = "()"
attr (return_value) is_exported
let @lam.function_returns = return_value
}

(lambda
parameters: (_) @params
body: (_) @body
) {
edge @body.before_scope -> @params.after_scope
edge @params.before_scope -> JUMP_TO_SCOPE_NODE
edge @params.after_scope -> @body.after_scope
}
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The lambda handling is split into two separate rules that could lead to duplication. Consider consolidating the common scope setup logic or adding a comment explaining why this separation is necessary for the grammar to work correctly.

Copilot uses AI. Check for mistakes.
Comment on lines 883 to +890
(parameter/typed_parameter
. (_) @name) @param
. (identifier) @name) @param
(parameter/typed_parameter
. (list_splat_pattern
(_) @name)) @param
(parameter/typed_parameter
. (dictionary_splat_pattern
(_) @name)) @param
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The parameter pattern matching rules are repetitive. Consider using a more concise pattern that captures all these cases, or add comments explaining the specific requirements for each pattern type.

Copilot uses AI. Check for mistakes.
@CleanCut
Copy link
Contributor

CleanCut commented Sep 9, 2025

The github/stack-graphs repository is no longer being maintained. As per #502, I'm closing all issues and pull requests before archiving the repository.

@CleanCut CleanCut closed this Sep 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants