Skip to content

Preserve single grouped expressions in function parameters - #889

Open
emme1t wants to merge 1 commit into
andialbrecht:masterfrom
emme1t:fix/single-grouped-function-arguments
Open

Preserve single grouped expressions in function parameters#889
emme1t wants to merge 1 commit into
andialbrecht:masterfrom
emme1t:fix/single-grouped-function-arguments

Conversation

@emme1t

@emme1t emme1t commented Sep 12, 2026

Copy link
Copy Markdown

Function.get_parameters() returns an empty list for single expression arguments such as abs(1 + 2), abs((1 + 2)), abs(CASE WHEN 1 THEN 2 ELSE 3 END), and abs(1 = 2).

These arguments have already been grouped into Operation, Parenthesis, Case, and Comparison nodes. Include those node types in the existing single-argument collection path. The regression tests verify that each complete argument is returned as one node with its original text and type.

Validation on Windows with Python 3.13.13:

  • All four new regression cases fail on the original implementation.
  • Full suite: 510 passed, 2 xfailed, 1 xpassed. A clean checkout of the original commit has the same expected-failure statuses: 506 passed, 2 xfailed, 1 xpassed. The existing XPASS is test_issue484_comments_and_newlines.
  • ruff check sqlparse and git diff --check pass.
  • All four example expressions were independently executed using SQLite 3.50.4's single-argument abs() function; they return 3, 3, 2, and 0 respectively. The parsed argument lists now contain the corresponding single expressions.

OpenAI Codex assisted with the source review, implementation, regression tests, and this description. The reported tests and SQLite checks were executed locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant