Skip to content

v0.6.0

Choose a tag to compare

@markng markng released this 08 Apr 22:23
· 18 commits to main since this release
Immutable release. Only release title and notes can be modified.
6730b50

What's Changed

Assignment-based dataflow type inference

pytest-leela now infers types through local variable assignments, even in code with no type annotations. This enables mutation pruning on previously untypeable code.

  • Forward propagation: x = "hello" → x + y is recognized as string concatenation and pruned (0 mutations instead of 2)
  • Parameter tracking: y = x where x: int correctly infers y as int
  • Conflict detection: x = 1; x = "a" → type collapses to unknown (safe)
  • Enrichment stats reporting: Terminal output now shows the breakdown:
    Type enrichment: 108 from annotations, 25 from assignment dataflow
    

Results on untyped code

  • 25 additional type enrichments from dataflow on a zero-annotation module
  • 7 additional mutations pruned
  • ~0 extra time cost (pure AST walk, no external dependencies)

Also includes

  • Extracted _type_of_value_node shared helper to deduplicate type inference
  • EnrichmentStats dataclass with __add__ for multi-file aggregation
  • 100% mutation kill rate (234/234 on target code, 590/590 overall)
  • Realistic untyped test target module (assignment_targets.py)

Full Changelog: v0.5.0...v0.6.0