package ppxlib

  1. Overview
  2. Docs
Standard infrastructure for ppx rewriters

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ppxlib-0.39.0.tbz
sha256=441a2814dbac3f5dc0c8dcefca263548e9b4d6dda1ef2990ce6a4999e108be3c
sha512=55ace8f9c8ddb6b495ace105c1b594b983fc37946bd3d9531c1c45160341d2b06e679785e2db76d885eaf481dbf11806e7d9674281c1599f28c38f39ba6b7ae6

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