Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ unreleased

### Other Changes

- Bump ppxlib's AST to 5.3.0 (#558, @patricoferris)

- Fix 5.2 -> 5.3 migration of constants. Those used to always have a `none`
location which can lead to unhelpful error messages.
(#569, @NathanReb)
Expand All @@ -29,6 +27,15 @@ unreleased
- Add custom printer support to `pp_ast` functions via the `?printer` config
parameter. (#526, @pedrobslisboa)

0.36.2
------

- Make Ast_builder's default `value_binding` constructor generate the proper
`pvb_constraint` from the pattern and expression arguments.
(#589, @NathanReb)
- Fix pprintast to output correct syntax from `Ppat_constraint (pat, Ptyp_poly ...)`
nodes until they are completely dropped. (#588, @NathanReb)

0.36.1 (2025-07-10)
-------------------

Expand Down
299 changes: 103 additions & 196 deletions ast/ast.ml

Large diffs are not rendered by default.

22 changes: 9 additions & 13 deletions ast/ast_helper_lite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
open Stdlib0
module Location = Astlib.Location
module Longident = Astlib.Longident
open Astlib.Ast_503
open Astlib.Ast_502

[@@@warning "-9"]

Expand Down Expand Up @@ -52,20 +52,16 @@ let protect_ref =
let with_default_loc l f = protect_ref (R (default_loc, l)) f

module Const = struct
let mk ?(loc = !default_loc) pconst_desc = { pconst_desc; pconst_loc = loc }
let integer ?loc ?suffix i = mk ?loc (Pconst_integer (i, suffix))
let int ?loc ?suffix i = integer ?loc ?suffix (Int.to_string i)
let int32 ?loc ?(suffix = 'l') i = integer ?loc ~suffix (Int32.to_string i)
let int64 ?loc ?(suffix = 'L') i = integer ?loc ~suffix (Int64.to_string i)

let nativeint ?loc ?(suffix = 'n') i =
integer ?loc ~suffix (Nativeint.to_string i)

let float ?loc ?suffix f = mk ?loc (Pconst_float (f, suffix))
let char ?loc c = mk ?loc (Pconst_char c)
let integer ?suffix i = Pconst_integer (i, suffix)
let int ?suffix i = integer ?suffix (Int.to_string i)
let int32 ?(suffix = 'l') i = integer ~suffix (Int32.to_string i)
let int64 ?(suffix = 'L') i = integer ~suffix (Int64.to_string i)
let nativeint ?(suffix = 'n') i = integer ~suffix (Nativeint.to_string i)
let float ?suffix f = Pconst_float (f, suffix)
let char c = Pconst_char c

let string ?quotation_delimiter ?(loc = !default_loc) s =
mk ~loc (Pconst_string (s, loc, quotation_delimiter))
Pconst_string (s, loc, quotation_delimiter)
end

module Attr = struct
Expand Down
17 changes: 8 additions & 9 deletions ast/ast_helper_lite.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

(** Copy of Ast_helper from OCaml 4.14 with docstring related stuff removed *)

open Astlib.Ast_503
open Astlib.Ast_502
open Asttypes
open Parsetree

Expand All @@ -38,15 +38,14 @@ val with_default_loc : loc -> (unit -> 'a) -> 'a
(** {1 Constants} *)

module Const : sig
val mk : ?loc:loc -> constant_desc -> constant
val char : ?loc:loc -> char -> constant
val char : char -> constant
val string : ?quotation_delimiter:string -> ?loc:loc -> string -> constant
val integer : ?loc:loc -> ?suffix:char -> string -> constant
val int : ?loc:loc -> ?suffix:char -> int -> constant
val int32 : ?loc:loc -> ?suffix:char -> int32 -> constant
val int64 : ?loc:loc -> ?suffix:char -> int64 -> constant
val nativeint : ?loc:loc -> ?suffix:char -> nativeint -> constant
val float : ?loc:loc -> ?suffix:char -> string -> constant
val integer : ?suffix:char -> string -> constant
val int : ?suffix:char -> int -> constant
val int32 : ?suffix:char -> int32 -> constant
val int64 : ?suffix:char -> int64 -> constant
val nativeint : ?suffix:char -> nativeint -> constant
val float : ?suffix:char -> string -> constant
end

(** {1 Attributes} *)
Expand Down
2 changes: 1 addition & 1 deletion ast/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

(*$ open Ast_cinaps_helpers $*)

module Js = Versions.OCaml_503
module Js = Versions.OCaml_502
module Ocaml = Versions.OCaml_current

module Select_ast (Ocaml : Versions.OCaml_version) = struct
Expand Down
7 changes: 1 addition & 6 deletions ast/location_error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ let of_extension (extension : Ast.extension) =
| {
pstr_desc =
Pstr_eval
( {
pexp_desc =
Pexp_constant { pconst_desc = Pconst_string (msg, _, _); _ };
_;
},
[] );
({ pexp_desc = Pexp_constant (Pconst_string (msg, _, _)); _ }, []);
_;
} ->
msg
Expand Down
Loading