Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1503,15 +1503,15 @@ end = struct
let check_and_spill_chr ~flags ~det_check_time ~time ~unknown ~type_abbrevs ~kinds ~types r =
let unknown = time_this time (fun () -> Type_checker.check_chr_rule ~unknown ~type_abbrevs ~kinds ~types r) in

let guard = Option.map (Spilling.main ~type_abbrevs ~types) r.guard in
let new_goal = Option.map (fun ({ Ast.Chr.conclusion } as x) -> { x with conclusion = Spilling.main ~types ~type_abbrevs conclusion }) r.new_goal in
if not flags.skip_det_checking then
time_this det_check_time (fun () ->
Option.iter (fun { Ast.Chr.conclusion } ->
Determinacy_checker.check_chr_guard_and_newgoal ~type_abbrevs ~types ~unknown ~guard:r.guard ~newgoal:conclusion)
r.new_goal);
Determinacy_checker.check_chr_guard_and_newgoal ~type_abbrevs ~types ~unknown ~guard ~newgoal:conclusion)
new_goal);
if Option.fold ~none:false ~some:(fun x -> has_cut ~types x.Ast.Chr.conclusion) r.new_goal then
error ~loc:r.loc "CHR new goals cannot contain cut";
let guard = Option.map (Spilling.main ~type_abbrevs ~types) r.guard in
let new_goal = Option.map (fun ({ Ast.Chr.conclusion } as x) -> { x with conclusion = Spilling.main ~types ~type_abbrevs conclusion }) r.new_goal in
unknown, { r with guard; new_goal }

let check ~flags st ~base u : checked_compilation_unit =
Expand Down
10 changes: 10 additions & 0 deletions tests/sources/bug_419.elpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
func f -> int.

func zero -> int.
zero 0.

constraint f {
rule (f X) <=> ({zero} = X).
}

main.
8 changes: 7 additions & 1 deletion tests/suite/elpi_specific.ml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ let () = declare "spill2"
~description:"spilling 2 arguments"
()

let () = declare "spill-chr"
~source_elpi:"bug_419.elpi"
~description:"spilling in chr"
()

let () = declare "spill_sigma"
~source_elpi:"spill_sigma.elpi"
~description:"spilling under sigma"
Expand Down Expand Up @@ -586,4 +591,5 @@ let () = declare "macro_uv"
~source_elpi:"macro_uv.elpi"
~description:"refreshing of macro body"
~expectation:Success
()
()

Loading