Skip to content

Commit

Permalink
now also include function calls in trace
Browse files Browse the repository at this point in the history
  • Loading branch information
cp526 committed Jan 22, 2024
1 parent d5275c1 commit ab922f6
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions backend/cn/check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -898,17 +898,25 @@ end = struct
)
in

let rec check args ftyp k =
match args, ftyp with
| (arg :: args), (Computational ((s, bt), _info, ftyp)) ->
check_arg arg ~expect:bt (fun arg ->
check args (subst rt_subst (make_subst [(s, arg)]) ftyp) k)
| [], (L ftyp) ->
k ftyp
| _ ->
let expect = count_computational original_ftyp in
let has = List.length original_args in
fail (fun _ -> {loc; msg = Number_arguments {expect; has}})
let check =
let rec aux args_acc args ftyp k =
match args, ftyp with
| (arg :: args), (Computational ((s, bt), _info, ftyp)) ->
check_arg arg ~expect:bt (fun arg ->
aux (args_acc @ [arg]) args (subst rt_subst (make_subst [(s, arg)]) ftyp) k)
| [], (L ftyp) ->
let@ () = match situation with
| FunctionCall fsym ->
add_trace_item_to_trace (Call (fsym, args_acc),loc)
| _ -> return ()
in
k ftyp
| _ ->
let expect = count_computational original_ftyp in
let has = List.length original_args in
fail (fun _ -> {loc; msg = Number_arguments {expect; has}})
in
fun args ftyp k -> aux [] args ftyp k
in

check args ftyp (fun lftyp ->
Expand Down

0 comments on commit ab922f6

Please sign in to comment.