Skip to content

fix: name the binding when a let repeats in one scope (#1434) - #1436

Closed
godofecht wants to merge 2 commits into
mainfrom
fix/1434-duplicate-let-diagnostic
Closed

godofecht wants to merge 2 commits into
mainfrom
fix/1434-duplicate-let-diagnostic

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Fixes #1434.

Reproduction (main 81ecf1e)

$ ./flow tool compiler/scripts/flowc_emit.flow --strict dup.flow dup.c
flowc emit: typecheck failed
flowc emit: tc_errs=1

flowc_tc_bind_value in compiler/src/typecheck.flow counted the error with flowc_tc_err and printed nothing.

Change

It now reports through the same diagnostic path as the effect checks (FILE:LINE:COL: error: ...), with the wording the playground compiler already uses:

dup.flow:3:9: error: variable 'a' is already declared in this scope
flowc emit: typecheck failed
flowc emit: tc_errs=1

The bundle path with an import prints the same line before flowc bundle tc: module check failed.

Bootstrap C regenerated in its own commit.

Proof

compiler/fixtures/typecheck_rules/duplicate_let.flow: fails with main's flowc (FAIL duplicate_let, 138/1), passes with this one (139/0).

Gates

flowc selftest PASS; --regen fixed point gen2; --verify PASS; typecheck_rules 139/0; parity_typecheck clean; test-lang 274/0; self_host_full ALL PASS; roundtrip ALL PASS; tests/cli 152/2 (jit_hello, test_mlir: golden drift on main). corpus_parity --check on Darwin: 1016 < floor 1033, the same pre-existing gap as on main (effects fixtures exit 134 under strict effects); no corpus file changes status because of this diff.

A second let of the same name in one block counted a type error and
printed nothing, so --strict failed with only tc_errs=1. The Stage-A
checker now prints FILE:LINE:COL: error: variable 'a' is already
declared in this scope, the wording the playground compiler uses.

typecheck_rules/duplicate_let fails with main's flowc and passes here.
Fixed point at gen2; bootstrap_from_c.sh --verify passes.
@godofecht

Copy link
Copy Markdown
Contributor Author

Landed in #1429 as 3891827 (lane C train).

@godofecht godofecht closed this Oct 7, 2026
@godofecht
godofecht deleted the fix/1434-duplicate-let-diagnostic branch October 12, 2026 23:03
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.

flowc: duplicate let in one scope fails the strict check with no diagnostic

1 participant