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

No sane way to report invalid arguments from a ppx preprocessor #6463

Closed
vicuna opened this issue Jun 19, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Jun 19, 2014

Original bug ID: 6463
Reporter: @whitequark
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:28:07Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.0+beta1 / +rc1
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @hcarty

Bug description

Currently I have code that looks like this:

let lwt_mapper args =
  args |> List.iter (fun arg ->
    match arg with
    | "-no-debug" -> debug := false
    | _ -> raise (Location.Error (Location.errorf "Unknown lwt.ppx argument: %s\n\n" arg));
  { default_mapper with
    expr = fun mapper expr ->
    match expr with
    | [%expr [%lwt let _ = [%e? exp]]] ->
      lwt_expression mapper exp

    | x -> default_mapper.expr mapper x;
  }

However, such error would presently be ignored by Ast_mapper.run_mapper.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 19, 2014

Comment author: @alainfrisch

Good point. Commit 14989 on 4.02 should fix that. Can you confirm?

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 19, 2014

Comment author: @whitequark

Sorry, I can't confirm at the moment--due to a bug in opam, reinstalling a switch requires a lot of manual work. But it seems like it would fix the bug.

I'll comment later.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 20, 2014

Comment author: @whitequark

Confirmed as working.

$ ocaml -ppx 'ppx_lwt -foo'
        OCaml version 4.02.0+dev10-2014-05-20                                                                                                                                                                                                                                                     
# 1;;
File "_none_", line 1:
Unknown lwt.ppx argument: -foo
#
@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 20, 2014

Comment author: @alainfrisch

Thanks for the feedback!

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.