Skip to content

feat(flowc): println/print intrinsics - #434

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

godofecht merged 1 commit into
mainfrom
work

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

  • compiler/src/typecheck.flow: recognize println, print, and puts as known intrinsics in flowc_tc_lookup_fn so they don't trigger unbound call errors.
  • compiler/src/cgen.flow: special-case println and print in the call emitter. println(x) emits printf with a format string based on the argument type: %d for ints, %s for strings, %f for floats. print(x) is the same without the newline. Adds flowc_cgen_emit_print_intrinsic helper.

Context

The self-hosted compiler could parse and typecheck its own source files, but programs using println (the standard Flow print intrinsic) failed typechecking with "unbound call" and generated C that referenced a nonexistent println function.

Test plan

  • ./flow run compiler/src/main.flow passes (flowc: PASS, 34 tests)
  • Self-hosted compiler compiles println(42) and produces correct output
  • Self-hosted compiler compiles println("hello world") and produces correct output

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/typecheck.flow: recognize println, print, and puts as
known intrinsics in flowc_tc_lookup_fn so they don't trigger unbound
call errors.

compiler/src/cgen.flow: special-case println and print in the call
emitter. println(x) emits printf with format string based on arg type:
%d for ints, %s for strings, %f for floats. print(x) is the same
without the newline. Add flowc_cgen_emit_print_intrinsic helper.

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

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

cursor Bot commented Aug 11, 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 0a5b240 into main Aug 11, 2026
12 of 13 checks passed
@godofecht
godofecht deleted the work branch August 11, 2026 21:32
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