Skip to content

feat(flowc): detect string-typed identifiers for str_concat lowering - #456

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

godofecht merged 1 commit into
mainfrom
work5

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

The C generator lowers string + string to __flowc_str_concat, but only detected AST_STRING, AST_CAST, AST_BINOP, and AST_CALL operands. AST_IDENT operands (e.g. function parameters named a, b) were missed, causing const char* + const char* in the emitted C.

Add flowc_cgen_ident_is_string: scans all AST_PARAM and AST_LET nodes for matching name. Only returns 1 if ALL matches have type string, avoiding false positives when a name is used as both string and non-string in different scopes.

Test plan

  • Self-host fixed-point passes (byte-identical)
  • Self-compile audit: all compiler/src modules pass
  • Roundtrip: all checks pass
  • string.flow now compiles without invalid operands to binary expression

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

Generated with Devin

The C generator lowers string + string to __flowc_str_concat, but
only detected AST_STRING, AST_CAST, AST_BINOP, and AST_CALL operands.
AST_IDENT operands (e.g. function parameters named a, b) were missed,
causing const char* + const char* in the emitted C.

Add flowc_cgen_ident_is_string: scans all AST_PARAM and AST_LET nodes
for matching name. Only returns 1 if ALL matches have type string,
avoiding false positives when a name is used as both string and
non-string in different scopes.

Fixes string.flow concat function (a + b with string params).

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 9b32ad6 into main Aug 12, 2026
15 checks passed
@godofecht
godofecht deleted the work5 branch August 12, 2026 15:53
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