Skip to content

Commit cc3ddcb

Browse files
committed
fix pp_clause
1 parent e1d5fa6 commit cc3ddcb

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# UNRELEASED
2+
3+
- Fix printing of clauses in trace
4+
15
# v1.16.5 (July 2022)
26

37
Requires Menhir 20211230 and OCaml 4.08 or above.

src/runtime.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ module Indexing = struct (* {{{ *)
22812281

22822282
let mustbevariablec = min_int (* uvar or uvar t or uvar l t *)
22832283

2284-
let ppclause f ~depth ~hd { args = args; hyps = hyps } =
2284+
let ppclause f ~hd { depth; args = args; hyps = hyps } =
22852285
Fmt.fprintf f "@[<hov 1>%a :- %a.@]"
22862286
(uppterm ~min_prec:(Elpi_parser.Parser_config.appl_precedence+1) depth [] ~argsdepth:0 empty_env) (C.mkAppL hd args)
22872287
(pplist (uppterm ~min_prec:(Elpi_parser.Parser_config.appl_precedence+1) depth [] ~argsdepth:0 empty_env) ", ") hyps
@@ -2756,7 +2756,7 @@ let rec claux1 loc get_mode vars depth hyps ts lts lcs t =
27562756
| Cons _ | Nil -> assert false
27572757
in
27582758
let c = { depth = depth+lcs; args; hyps; mode = get_mode hd; vars; loc } in
2759-
[%spy "dev:claudify:extra-clause" ~rid (ppclause ~depth:(depth+lcs) ~hd) c];
2759+
[%spy "dev:claudify:extra-clause" ~rid (ppclause ~hd) c];
27602760
(hd,c), { hdepth = depth; hsrc = g }, lcs
27612761
| UVar ({ contents=g },from,args) when g != C.dummy ->
27622762
claux1 loc get_mode vars depth hyps ts lts lcs
@@ -3475,7 +3475,7 @@ let pred_of g =
34753475
let pp_candidate ~depth ~k fmt ({ loc } as cl) =
34763476
match loc with
34773477
| Some x -> Util.CData.pp fmt (Ast.cloc.Util.CData.cin x)
3478-
| None -> Fmt.fprintf fmt "hypothetical clause: %a" (ppclause ~depth ~hd:k) cl
3478+
| None -> Fmt.fprintf fmt "hypothetical clause: %a" (ppclause ~hd:k) cl
34793479

34803480
let hd_c_of = function
34813481
| Const _ as x -> x
@@ -3611,7 +3611,7 @@ let make_runtime : ?max_steps: int -> ?delay_outside_fragment: bool -> 'x execut
36113611
| [] -> [%spy "user:rule:backchain" ~rid ~gid pp_string "fail"];
36123612
[%tcall next_alt alts]
36133613
| { depth = c_depth; mode = c_mode; args = c_args; hyps = c_hyps; vars = c_vars; loc } :: cs ->
3614-
[%spy "user:rule:backchain:try" ~rid ~gid (pp_option Util.CData.pp) (Util.option_map Ast.cloc.Util.CData.cin loc) (ppclause ~depth ~hd:k) { depth = c_depth; mode = c_mode; args = c_args; hyps = c_hyps; vars = c_vars; loc }];
3614+
[%spy "user:rule:backchain:try" ~rid ~gid (pp_option Util.CData.pp) (Util.option_map Ast.cloc.Util.CData.cin loc) (ppclause ~hd:k) { depth = c_depth; mode = c_mode; args = c_args; hyps = c_hyps; vars = c_vars; loc }];
36153615
let old_trail = !T.trail in
36163616
T.last_call := alts == noalts && cs == [];
36173617
let env = Array.make c_vars C.dummy in
@@ -3656,7 +3656,7 @@ let make_runtime : ?max_steps: int -> ?delay_outside_fragment: bool -> 'x execut
36563656
let rec prune ({ agid = agid[@trace]; clauses; adepth = depth; agoal_hd = hd } as alts) =
36573657
if alts != cutto_alts then begin
36583658
List.iter (fun c ->
3659-
[%spy "user:rule:cut:branch" ~rid UUID.pp agid (pp_option Util.CData.pp) (Util.option_map Ast.cloc.Util.CData.cin c.loc) (ppclause ~depth ~hd) c])
3659+
[%spy "user:rule:cut:branch" ~rid UUID.pp agid (pp_option Util.CData.pp) (Util.option_map Ast.cloc.Util.CData.cin c.loc) (ppclause ~hd) c])
36603660
clauses;
36613661
prune alts.next
36623662
end

0 commit comments

Comments
 (0)