Skip to content

Commit

Permalink
fix var spilling (fix #309)
Browse files Browse the repository at this point in the history
  • Loading branch information
gares committed Jan 22, 2025
1 parent 1992fb3 commit 67ba3ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ end = struct
| Impl(b,s,t) -> Impl(b,s,aux t)
| Const(g,c) -> mkApp g c args
| App(g,c,x,xs) -> mkApp g c (x :: xs @ args)
| Var _
| Var(c,l) -> Var (c,l @ args)
| Discard | Lam (_, _, _)
| CData _ | Spill (_, _) | Cast (_, _) -> assert false
and aux_last = function
Expand Down
4 changes: 4 additions & 0 deletions tests/sources/spill-var.elpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pred iterate i:(pred i:A, o:A), i:A, o:(list A).
iterate F X [X|XS] :- iterate F {F X} XS ; XS = [].

main.
4 changes: 4 additions & 0 deletions tests/suite/elpi_specific.ml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ let () = declare "spill_collision"
~description:"spilling under 2 pi named the same"
()

let () = declare "spill-var"
~source_elpi:"spill-var.elpi"
~description:"spilling a var"
()

let () = declare "block"
~source_elpi:"block.elpi"
Expand Down

0 comments on commit 67ba3ca

Please sign in to comment.