-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some pretty printing failures #2825
Comments
Hi Guido, I just noticed an issue with pretty-printing after normalising with (* Strange pretty-printing behaviour with nbe and pattern-matching. *)
(* Examples use dump tactic to show pretty-printed expressions after simplifying - the actual assertion is not interesting *)
module PrettyPrint
let ok (): unit =
(* This example pretty-prints ok: snd is printed as something like `match (_, _2) -> _2` *)
assert (exists e. e == snd #unit #unit) by
(FStar.Tactics.norm [primops; iota; zeta; delta]; FStar.Tactics.dump "ok")
let nok (): unit =
(* If we add `nbe` to the norm tactic, the body of `snd` is pretty-printed as `match (_, _) -> _` where we lose the body *)
assert (exists e. e == snd #unit #unit) by
(FStar.Tactics.norm [nbe; primops; iota; zeta; delta]; FStar.Tactics.dump "nok") |
Hi Amos, thanks for reporting. It's indeed related, resugaring is not very smart about which names nor shadowing. You can avoid that by using #2808 is also related to that. I will give this a shot to see if we can improve it. However that particular problem with NBE is fixable, we just need to keep track of the names when translating. Pushing a fix soon. |
Thanks Guido! Your recent commit works for me (as does |
Result of
--print
:So:
1- pushed a binder from the type into a pattern, but the body did not change accordingly
2-
Prims._assert
gets replaced withassert
in the vquote, which then does not parse3- The contraction of
fun x -> match x with ...
does not take into account thatx
appears in the branches4- Some weird thing with nameless refinements.
These seem to be all the parsing failures we get if we pretty-print the entire library, so not too bad!
The text was updated successfully, but these errors were encountered: