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
Closed

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

vicuna opened this issue Jun 19, 2014 · 4 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna 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
Copy link
Author

vicuna commented Jun 19, 2014

Comment author: @alainfrisch

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

@vicuna
Copy link
Author

vicuna 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
Copy link
Author

vicuna 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
Copy link
Author

vicuna commented Jun 20, 2014

Comment author: @alainfrisch

Thanks for the feedback!

@vicuna vicuna closed this as completed Dec 11, 2015
@vicuna vicuna added the bug label Mar 20, 2019
avsm pushed a commit to avsm/ocaml that referenced this issue Jun 21, 2020
… (typically, invalid arguments) to the compiler.

git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@14989 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants