Repository navigation
Conversation
The C path turns each method of `impl Trait for Type` into the top-level function Type_Trait_method before parsing. The MLIR path left impl blocks out, as the retired Python MLIR generator did, so every call to Type_Trait_method was a call to an undeclared function and was refused. flowc_expand_for_mlir_in_place now runs the impl expansion too. Fixture: compiler/fixtures/mlir/trait_impl.flow.
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 14, 2026
godofecht
enabled auto-merge
October 15, 2026 16:07
- Resolves conflicts in `compiler/src/resolve.flow` and `compiler/src/mlir_bundle.flow` - Updates `docs/demos/overview.md` - Regenerates MLIR corpus - Regenerates `compiler/bootstrap/flowc_stage_a.c` Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: godofecht <[email protected]>
Contributor
Author
|
Superseded by #1676 (migration onto current main; CI green). Closing this historical PR. |
auto-merge was automatically disabled
November 5, 2026 08:10
Pull request was closed
Open
19 of 37 tasks
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.
Cause
impl Trait for Type { function m(self, ...) }defines the top-levelfunction
Type_Trait_mon the C path:flowc_expand_all_in_placerunsflowc_impl_expand_in_placebefore parsing. The MLIR path'sflowc_expand_for_mlir_in_placeleft impl blocks out, following theretired Python MLIR generator, which emitted nothing for them. Every call
to
Type_Trait_mwas then a call to an undeclared function, refused with"argument of this type to an undeclared function" (a struct argument). 3
corpus programs failed this way:
tests/lang/test_trait_impl.flow,tests/lang/test_rt_safe_trait.flow,examples/generics_traits/traits_demo.flow.Fix
flowc_expand_for_mlir_in_placeruns the impl expansion after the DSLstages, as the C path does. The generic struct literal inference stays C
only, as before. The change is two lines in
compiler/src/resolve.flowand its comment.
Regression fixture:
compiler/fixtures/mlir/trait_impl.flow(two impls ofone trait, a method calling another through
Type_Trait_m). On main itfails with "argument of this type to an undeclared function".
Counts
mlir_vs_c --only 'trait|lib/stdlib/audio/processor.flow', over the 17 programs on main that the C backend builds:The new fixture is same as well. The mlir-link program (
compiler/fixtures/dynamics_dsl/ok_portrait.flow) fails the same way on main.Full corpus run (
mlir_vs_c --jobs 8): queued behind the machine-wide corpus lock; the before and after counts will be added here.Gates
bootstrap_from_c.sh --regen, then--verify: PASSmlir_math_override, which fails in itsC-backend half (
flow run --backend=cexits 1). This change touches onlythe MLIR emitter, so the C path is the same as on main.
Regenerated state
compiler/bootstrap/flowc_stage_a.candcompiler/bootstrap/flowc_stage_a,in their own last commit.
compiler/fixtures/mlir/trait_impl.mlirand.out, recorded withparity_mlir.flow --record.compiler/fixtures/mlir/corpus.txt: three digests added (examples/generics_traits/traits_demo.flow,tests/lang/test_rt_safe_trait.flow,tests/lang/test_trait_impl.flow, now accepted) and three moved (compiler/fixtures/typecheck_rules/rt_safe_trait_impl_bad.flow,lib/stdlib/audio/processor.flow,tests/lang/test_trait.flow), because their impl methods are now emitted. No other digest moved.--recordalso wanted to add 11 programs this change does not affect (corpus drift on main); those lines are left out.Risk
Low to moderate. Every MLIR emit of a program with an impl block now
contains its methods. Before, those programs either did not call them
(the methods were dead) or were refused. Lane A works on imports and
bundling in
resolve.flowandmlir_bundle.flow; this touches onlyflowc_expand_for_mlir_in_place.Needs review by a CODEOWNER (touches compiler/).