Sitelet https://github.com/starkware-libs/cairo/pull/10063
Skip to content

bugfix(parser): Improved missing comma diag. - #10063

Merged
orizi merged 1 commit into
mainfrom
orizi/06-08-bugfix_parser_improved_missing_comma_diag
Jun 8, 2026
Merged

orizi merged 1 commit into
mainfrom
orizi/06-08-bugfix_parser_improved_missing_comma_diag

Conversation

@orizi

@orizi orizi commented Jun 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes the diagnostic message for a missing comma in single-element tuple expressions. The ParserDiagnosticKind::MissingToken was referencing SyntaxKind::TokenComma instead of SyntaxKind::TerminalComma, which caused the error message to display Missing token TokenComma. instead of the human-readable Missing token ','.


Type of change

Please check one:

  • Bug fix (fixes incorrect behavior)
  • New feature
  • Performance improvement
  • Documentation change with concrete technical impact
  • Style, wording, formatting, or typo-only change

Why is this change needed?

The diagnostic emitted when a single-element tuple is missing its trailing comma was referencing the wrong SyntaxKind variant (TokenComma instead of TerminalComma). This caused the error message to expose an internal token kind name rather than the expected human-readable punctuation character.


What was the behavior or documentation before?

When writing a single-element tuple without a trailing comma (e.g., (felt252)), the parser emitted:

error[E1001]: Missing token TokenComma.

What is the behavior or documentation after?

The parser now correctly emits:

error[E1001]: Missing token ','.

Related issue or discussion (if any)

N/A


Additional context

N/A

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

orizi commented Jun 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@orizi
orizi marked this pull request as ready for review June 8, 2026 15:26
@cursor

cursor Bot commented Jun 8, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
One-line diagnostic kind fix in the parser with an updated snapshot test; no parsing or semantic behavior change.

Overview
Fixes the missing trailing comma diagnostic for single-element type tuples in expect_type_tuple_expr (e.g. return type (felt252) instead of (felt252,)).

The parser now passes SyntaxKind::TerminalComma into ParserDiagnosticKind::MissingToken, aligning with other missing-terminal diagnostics that use terminal kinds so the message shows Missing token ','. rather than the internal label TokenComma. Parser test expectations for function_signature were updated accordingly.

Reviewed by Cursor Bugbot for commit 981228d. Bugbot is set up for automated code reviews on this repo. Configure here.

@orizi
orizi enabled auto-merge June 8, 2026 17:53

@TomerStarkware TomerStarkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:lgtm:

@TomerStarkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on eytan-starkware).

@orizi
orizi added this pull request to the merge queue Jun 8, 2026
Merged via the queue into main with commit ae61ac0 Jun 8, 2026
54 checks passed
@orizi
orizi deleted the orizi/06-08-bugfix_parser_improved_missing_comma_diag branch June 9, 2026 08:11
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.

3 participants