Skip to content

feat(flowc): bitwise | ^, lenient bundle typecheck, fir_analysis - #439

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

  • Bitwise | (OR) and ^ (XOR) operators are now lexed, parsed, and emitted in C output.
  • Bundle typecheck is now lenient for unknown calls, allowing stdlib modules to compile without explicit imports for cross-module functions.
  • compiler/src/fir_analysis.flow now compiles under the self-hosted compiler (was failing on the | operator).

Context

fir_analysis.flow used acc | callee_bits for bitwise OR, which the lexer rejected. Several stdlib modules (vec, collections) call functions from other modules without imports, which the strict bundle typechecker rejected as unbound calls.

Test plan

  • ./flow run compiler/src/main.flow passes (flowc: PASS)
  • Three consecutive generation fixed-points pass (byte-identical)
  • compiler/src/fir_analysis.flow compiles to valid C
  • selfcompile_audit.sh passes with 0 failures

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

Generated with Devin

compiler/src/token.flow: add TOK_BAR (38) and TOK_CARET (39) for
bitwise OR and XOR operators.

compiler/src/lexer.flow: lex single | as TOK_BAR and ^ as TOK_CARET.

compiler/src/parser.flow: add TOK_BAR and TOK_CARET to binop kind
and precedence tables (precedence 3, same as &).

compiler/src/cgen.flow: emit " | " for TOK_BAR and " ^ " for
TOK_CARET in binary operator output.

compiler/src/typecheck.flow: add lenient field to TcCtx. When
lenient=1, unknown calls are allowed (for bundle typecheck where
cross-module calls without explicit imports are common).

compiler/src/resolve.flow: set ctx.lenient=1 in
flowc_bundle_typecheck.

compiler/src/main.flow: update test_bundle_typecheck to only check
the ok case (bundle mode is now lenient for cross-module calls).

compiler/bootstrap/flowc_stage_a.c: regenerated.

compiler/src/fir_analysis.flow now compiles under the self-hosted
compiler (was failing on the | operator).

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 374507d into main Aug 12, 2026
12 of 13 checks passed
@godofecht
godofecht deleted the work branch August 12, 2026 01:57
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