refactor: De-duplicate produces_output onto the canonical capture_shape helper#507
Merged
Merged
Conversation
…pe helper ## Summary - Delete the private `produces_output` copy in the type-inference pass (`infer.rs`) and call the canonical `capture_shape::produces_output` instead. - Repoint both inference call sites to pass the `TypeContext` explicitly, since the free function takes it as an argument rather than reading it from `self`. ## Why `produces_output` decides whether a capture contributes real data to the output, so it drives both the generated TypeScript types and the JSON the VM emits — the two must agree or the output is type-unsound (#420). `capture_shape.rs` is the single source of truth for exactly this; the inference pass carried a logically identical private duplicate that could silently drift. Behavior is unchanged.
zharinov
enabled auto-merge (squash)
June 21, 2026 18:45
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.
Summary
produces_outputhad two copies of the same logic: a shared public one incapture_shape.rsand a private one inside the type-inference pass.Why
produces_outputdecides whether a capture adds real data to the output. It controls two things that must match: the TypeScript types we generate and the JSON the VM emits. If they disagree, the output is type-unsound (#420).capture_shape.rsis meant to be the single place this logic lives, so the inference pass shouldn't keep its own copy that can drift.Notes
Both copies were already identical, so this is a pure refactor with no behavior change.