package ppxlib

  1. Overview
  2. Docs
Standard infrastructure for ppx rewriters

Install

dune-project
 Dependency

Authors

Maintainers

Sources

2e150834476230e99e48dfdf34c5e4a1ea6e749b.tar.gz
sha256=591d694609fed01783c9f360602e8660ae0e49eb33b7074c1317a261e00c6cdb
sha512=e15e956a114ab3f61dfa8f7eceed088082a116f3b6fc832b901729f611258af3b39bda748b2046b4886f429617aa64802f90e0520db82302443ecbba461970b2

doc/src/ppxlib.astlib/error.ml.html

Source file error.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
let raise_error_txt ~loc = Location.raise_errorf ~loc "%a" Format.pp_print_text

let migration_error ~loc ~from ~to_ msg =
  let s =
    Format.sprintf
      "ppxlib migration error (migrating ocaml.%s to ocaml.%s): %s\n\n\
       Ppxlib was likely trying to migrate from %s to 5.2.0 and back again, \
       but encountered an AST node that could not be encoded. Either remove \
       the feature or open an issue at \
       https://github.com/ocaml-ppx/ppxlib/issues."
      from to_ msg Sys.ocaml_version
  in
  raise_error_txt ~loc s

let invalid_encoding ~loc ~version msg =
  let s =
    Format.sprintf
      "ppxlib invalid encoding: %s\n\n\
       Ppxlib failed to decode a feature from the OCaml %s AST. This is likely \
       caused by the use of a %s+ language feature within code directly \
       interpreted by a ppx. If you'd like this feature to be supported by the \
       ppx involved, please reach out to the ppx maintainers. If this does not \
       seem right, please do open an issue at \
       https://github.com/ocaml-ppx/ppxlib/issues."
      msg version version
  in
  raise_error_txt ~loc s