Skip to content

Commit

Permalink
Env: filtering units from environment print
Browse files Browse the repository at this point in the history
  • Loading branch information
mtzguido committed Sep 10, 2024
1 parent 33b23fc commit ce3b6a8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/checker/Pulse.Typing.Env.fst
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,25 @@ let rec separate_map (sep: document) (f : 'a -> T.Tac document) (l : list 'a) :
| x::xs -> f x ^^ sep ^/^ separate_map sep f xs

let env_to_doc (e:env) : T.Tac document =
let erase_units = not (Pulse.Config.debug_flag "no_filter_env") in
let pp1 : ((var & typ) & ppname) -> T.Tac document =
fun ((n, t), x) ->
infix 2 1 colon
(doc_of_string (T.unseal x.name ^ "#" ^ string_of_int n))
(align (Pulse.Syntax.Printer.term_to_doc t))
in
brackets (separate_map comma pp1 (T.zip e.bs e.names))
let maybe_filter vtns =
if erase_units then
vtns |> T.filter (fun ((n, t), x) ->
let is_unit = FStar.Reflection.TermEq.term_eq t (`unit) in
let x : ppname = x in
let is_wild = T.unseal x.name = "_" in
not (is_unit && is_wild)
)
else
vtns
in
T.zip e.bs e.names |> maybe_filter |> separate_map comma pp1 |> brackets

let get_range (g:env) (r:option range) : T.Tac range =
match r with
Expand Down

0 comments on commit ce3b6a8

Please sign in to comment.