Context
partial_eval.py is one of the highest-risk files in the project: it owns compile-time evaluation, constant folding, dead-code elimination, loop unrolling, call inlining, and flattening. It is large enough that unrelated changes are likely to collide and tests are similarly concentrated.
Evidence
src/kida/compiler/partial_eval.py is 2,307 lines.
PartialEvaluator spans about 1,671 lines.
_transform_expr alone is about 298 lines.
tests/test_partial_eval.py is 3,527 lines.
Proposed Scope
- Split the implementation along behavior boundaries, such as expression evaluation, control-flow transforms, call/def inlining, loop unrolling, and flattening.
- Preserve the public
partial_evaluate_template() entrypoint.
- Split or regroup tests around the same behavior boundaries.
- Include benchmark/no-benchmark rationale because this is compiler hot-path-adjacent.
Done When
- Partial-eval changes can be reviewed in smaller files with clear ownership.
- Existing partial-eval tests still pass.
- Compiler benchmark expectations are unchanged or documented.
Context
partial_eval.pyis one of the highest-risk files in the project: it owns compile-time evaluation, constant folding, dead-code elimination, loop unrolling, call inlining, and flattening. It is large enough that unrelated changes are likely to collide and tests are similarly concentrated.Evidence
src/kida/compiler/partial_eval.pyis 2,307 lines.PartialEvaluatorspans about 1,671 lines._transform_expralone is about 298 lines.tests/test_partial_eval.pyis 3,527 lines.Proposed Scope
partial_evaluate_template()entrypoint.Done When