Skip to content

fix(flowc): self-referential struct pointer fields use struct tag - #458

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

godofecht merged 1 commit into
mainfrom
work7

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

Inside a typedef struct body, the typedef name is not yet visible in C. A field like next: ptr<ListNode_i32> inside struct ListNode_i32 was emitted as ListNode_i32* next, which fails with "must use 'struct' tag to refer to type 'ListNode_i32'".

Now detects self-referential ptr<StructName> fields and emits struct StructName* instead. Also handles the array-of-self-ptr case.

Test plan

  • Self-host fixed-point passes (byte-identical)
  • Self-compile audit: all compiler/src modules pass
  • Roundtrip: all checks pass
  • collections.flow no longer has must use 'struct' tag error

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

Generated with Devin

Inside a typedef struct body, the typedef name is not yet visible in C.
A field like `next: ptr<ListNode_i32>` inside `struct ListNode_i32` was
emitted as `ListNode_i32* next`, which fails with "must use 'struct' tag
to refer to type 'ListNode_i32'".

Now detects self-referential ptr<StructName> fields and emits
`struct StructName*` instead. Also handles the array-of-self-ptr case.

Fixes collections.flow ListNode_i32 self-referential struct.

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 d30ab7b into main Aug 12, 2026
15 checks passed
@godofecht
godofecht deleted the work7 branch August 12, 2026 18:49
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