Repository navigation
Stage-A batch 3: libc builtins, generic calls, ptr receivers, &[T] spans, unit dimensions, parse-reject audit - #1015
Merged
Merged
Conversation
godofecht
force-pushed
the
fix/stage-a-batch-3
branch
3 times, most recently
from
September 29, 2026 09:12
ede4cd4 to
e2644dd
Compare
godofecht
force-pushed
the
fix/stage-a-batch-3
branch
from
September 29, 2026 09:40
e2644dd to
6c1cf8b
Compare
…receivers, declare &[T] spans (#1006, #1007) - typecheck: the Python checker's BUILTIN_FUNCTIONS table (printf, strlen, sqrt, malloc and the rest) is known without an extern block. - typecheck: an explicit instantiation f<T>(args) is not held to the template's T-typed parameters; an implicit generic call still reports no matching overload, as the Python checker does. - cgen: recv.method(args) on a by-value struct passes &recv when the first parameter is ptr<ThatStruct>, as _gen_method_call does. - cgen: &[T] / &mut [T] parameters declare their flowc_span_T typedef, and an array argument converts to the parameter's span type. - cgen: a capturing lambda takes its environment pointer first, matching the closure's fn(&env, ...) call. The eight flowc-side lines leave compiler/parity_lowering/divergent.txt.
typecheck.flow gains the units-of-measure pass from src/flow/type_checker.py: unit registration (base and derived, duplicate and unknown-factor errors), dimension composition through * and /, the + - % and comparison rules, the operator rule for logical, bitwise and shift, casts into and out of units, the dimensionless-or-Radian rule for sin and friends, and the unit branch of coercion at let, assignment, return, call arguments, struct literals, consts and module statics. Messages match the Python checker word for word, including the line of the operator, so binary-operator nodes now span their operator token. Unknown types never report, so a gap can only accept what Python rejects. All 31 cases of tests/unit/test_units.py and 12 more give the same errors on both checkers. compiler/parity_lowering gains seven negative unit fixtures and a runtime test, with goldens from the Python host; a Python type error's golden is its first ✗ line.
compiler/parse_coverage/python_rejects.txt now files each entry under its reason: negative fixtures, source for a pre-parse DSL expansion, Flow-only \x escapes, docs/vision sketches, and the flow-verify proof corpus. None is a broken program. Two files were broken and now parse on both parsers: - scripts/tools/wasm_crossings/main.flow named a local `module`, a keyword in the Python lexer. - tests/runtime/wip/test_short_circuit.flow used block expressions; it now counts evaluations through a pointer and passes on both hosts. 23 tracked files the Python parser rejects were missing from the list (fixtures added since, and tools/repl); they are listed and classified.
The bundle typecheck seeded an import's functions and consts but not the C functions its extern block declares, so lib/stdlib/ui2d.flow (SDL_Init from stdlib/sdl2.flow) and the Vulkan layout demos stopped at `unbound call`. They are now seeded, and flowc_cgen_collect_sigs records their return types so an importer's inferred `let` gets the C type. demos/vulkan_tetris_flow read `_ui_state[0].unit` through the untyped layout pointer, which neither host can compile; it now calls ui_layout_unit(_ui_state) like the examples/demos copy. The 11 lines left in compiler/parity_lowering/divergent.txt are Python host import failures; flowc builds all 11.
godofecht
force-pushed
the
fix/stage-a-batch-3
branch
from
September 29, 2026 10:18
6c1cf8b to
220c448
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage-A batch 3. Built on #1012 (merged in, together with origin/main), so it also carries #1001 and #1003 until those land.
Fixes #1006
Fixes #1007
Fixes #1008
Fixes #997
flowc changes
flowc typecheck: know the libc functions the Python checker knows (printf without an extern) #1006 typecheck knows the Python checker's
BUILTIN_FUNCTIONStable (printf, strlen, sqrt, malloc and the rest), so these calls need no extern block.flowc: three gaps found by the #996 parity corpus (generic call check, ptr<Struct> argument, span<f64>) #1007
f<T>(args)is no longer held to the template'sT-typed parameters. An implicit generic call still reportsno matching overload, as the Python checker does.recv.method(args)passes&recvwhen the receiver is a by-value struct and the first parameter isptr<ThatStruct>(the rule in_gen_method_call).&[T]/&mut [T]parameters declare theirflowc_span_Ttypedef, and an array argument converts to the parameter's span type. It used to always beflowc_span_int32_t.lambda_N_env* _envfirst, which matches the closure'sfn(&env, ...)call. This was behind 08_types_patterns once the typecheck error was gone.flowc: check unit dimensions like the Python checker #1008 A units-of-measure pass in typecheck.flow, ported from
type_checker.py:*and/composition and canonical names+ - %and comparison rulesThe messages match word for word, including
line N:, so binary-operator nodes now span their operator token. All 31 cases intests/unit/test_units.pyand 12 more produce identical error sets on both checkers. Unknown types never report.The bundle typecheck now sees C functions declared in an imported module's extern block, and
collect_sigsrecords their return types. This fixedui2d.flow(SDL_Init) and the Vulkan layout demos.Parity corpus
compiler/parity_lowering/divergent.txt.demos/vulkan_tetris_flowread_ui_state[0].unitthrough the untyped pointer).tests/lang/test_units_dimensions.flow, with goldens from the Python host at 5f36fc6.✗line.#997 audit
python_rejects.txtnow files every entry under a reason:\xescapesTwo files were broken and now parse on both parsers:
wasm_crossings/main.flow, which used the local namemodule, andtests/runtime/wip/test_short_circuit.flow, which used block expressions. 23 files the Python parser rejects were missing from the list and are now listed. The list matches the Python parser exactly (checked over all 2341 tracked files).Verification
bootstrap_from_c.sh --verifyself_host_full.shroundtrip.shparse_coverage.sh --checkparity_lowering.sh--python HEADalso fail 0cc -cover all tracked.flowIn the bundle emit row, the only files that went from pass to fail are the five new negative unit fixtures.
New tests in tests/lang:
test_libc_builtins,test_generic_explicit_call,test_method_ptr_receiver,test_slice_f64_param,test_imported_extern,test_units_dimensions. Each runs with exit 0 on both hosts.