Skip to content

feat(flowc): trailing commas, fix generic arg vs comparison - #446

Merged
godofecht merged 1 commit into
mainfrom
work
Aug 12, 2026
Merged

godofecht merged 1 commit into
mainfrom
work

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

  • Handle trailing commas in array literals ([1, 2, 3,]).
  • Fix generic type arg check to reject keywords inside <...>. Previously x < A or x > B was misparsed as x<A or x> B because or (a keyword) was allowed inside the generic arg skip loop. Now only identifiers, commas, and dots are accepted inside <...>, so comparison expressions with or/and parse correctly.

Context

font.flow has a 665-element array literal with trailing commas. ui_layout.flow uses if x < A or x > B { ... } where the or keyword was being swallowed by the generic type arg skip logic.

Test plan

  • ./flow run compiler/src/main.flow passes (flowc: PASS)
  • Three consecutive generation fixed-points pass (byte-identical)
  • Self-compile audit: all compiler/src modules pass
  • Roundtrip: bundle_tc_bad correctly fails (rc=1)
  • font.flow now emits C (665-element array with trailing commas)
  • ui_layout.flow now emits C (or in if conditions)
  • rf.flow still emits C (generic struct Signal still works)

This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.

Generated with Devin

…mparison

compiler/src/parser.flow:
- Handle trailing commas in array literals ([1, 2, 3,]).
- Fix generic type arg check to reject keywords inside <...>.
  Previously `x < A or x > B` was misparsed as `x<A or x> B` because
  `or` (a keyword) was allowed inside the generic arg skip loop.
  Now only identifiers, commas, and dots are accepted inside <...>,
  so comparison expressions with `or`/`and` parse correctly.
- Remove duplicate TOK_GT import.

lib/stdlib/font.flow now parses (665-element array with trailing commas).
lib/stdlib/ui_layout.flow now parses (uses `or` in if conditions).

compiler/bootstrap/flowc_stage_a.c: regenerated.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@godofecht
godofecht merged commit d89f05b into main Aug 12, 2026
15 checks passed
@godofecht
godofecht deleted the work branch August 12, 2026 06:40
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