Skip to content

feat(optimization): eliminate dead branches using liquid refinements (#114)#463

Open
alcides wants to merge 1 commit into
masterfrom
fix/liquid-types-optimization-114
Open

feat(optimization): eliminate dead branches using liquid refinements (#114)#463
alcides wants to merge 1 commit into
masterfrom
fix/liquid-types-optimization-114

Conversation

@alcides

@alcides alcides commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a post-typecheck optimization pass that uses SMT entailment to remove if branches made unreachable by liquid refinements in scope (closes Liquid Types Optimization #114).
  • Emit dead-branch warnings in the CLI and LSP when a branch is eliminated.
  • Fix optimize_bindings to preserve all Rec metadata (including mutual-recursion companions) when folding binding bodies.

Test plan

  • pytest tests/refinement_branch_opt_test.py
  • pytest tests/contata_test.py::test_cata_recovers_evaluable_definitions (mutual recursion spine preserved)
  • pytest tests/optimization_test.py
  • pre-commit (mypy, ruff) passes locally

Made with Cursor

@cursor
cursor Bot force-pushed the fix/liquid-types-optimization-114 branch 2 times, most recently from 0d28f08 to e75a276 Compare July 11, 2026 03:00
@cursor
cursor Bot force-pushed the fix/liquid-types-optimization-114 branch 3 times, most recently from c9f7118 to 1754c34 Compare July 15, 2026 03:03
…114)

When parameter refinements entail an if-condition, remove the unreachable
branch after typechecking and emit a warning. Fix optimize_bindings to
preserve mutual-recursion metadata on Rec nodes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor
cursor Bot force-pushed the fix/liquid-types-optimization-114 branch from 1754c34 to 743025b Compare July 16, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Liquid Types Optimization

1 participant