Skip to content
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

Loss of ppx context in toplevel after an exception #7098

Closed
vicuna opened this issue Dec 17, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Dec 17, 2015

Original bug ID: 7098
Reporter: @whitequark
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2017-02-16T14:18:07Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.3
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @alainfrisch

Bug description

$ cat t.ml
#use "topfind";;
#require "ppx_deriving.std";;
#require "ppx_import";;

type t = int [@@deriving show];;
type u = int [@@deriving nonexistent];;
type t = int [@@deriving show];;
$ ocaml <t.ml
[snip]
Cannot locate deriver show

Note that the first [@@deriving show] succeeds, but the second one fails.

Also note the ocaml <t.ml (otherwise the toplevel will stop on the first error), and that if you remove #require "ppx_import";;, the bug stops manifesting itself.

Triaged from https://github.com/whitequark/ppx_import/issues/3.

File attachments

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 17, 2015

Comment author: @alainfrisch

Confirmed: when a ppx raises an error, it returns an empty ppx context, which resets all "cookies" used to maintain the state of ppxs.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 17, 2015

Comment author: @alainfrisch

A proposed fix is attached, in case someone needs to backport it to 4.02. It also committed to trunk ( 713447b ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.