From 5936109602ac55f78d83405a264391eff852ce37 Mon Sep 17 00:00:00 2001 From: Patrick Ferris Date: Thu, 28 Nov 2024 00:20:19 +0000 Subject: [PATCH] Switch dummy_pos depending on compiler version In OCaml 4.08 the dummy position was changed to have a pos_lnum of 0 instead of 1. We need to match whatever the compiler is using. Signed-off-by: Patrick Ferris --- CHANGES.md | 3 + astlib/location.ml | 4 + astlib/location.mli | 4 + src/location.ml | 3 +- test/metaquot/test.ml | 180 ++++++++++++++++----------------- test/type_is_recursive/test.ml | 4 +- 6 files changed, 104 insertions(+), 94 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7fab6ae55..171c8e651 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -28,6 +28,9 @@ details. to what the compiler's `-dparsetree` is. (#530, @NathanReb) +- Change the default, dummy position in `Location.ml` to match the compiler's + (#540, @ncik-roberts, @patricoferris) + 0.33.0 (2024-07-22) ------------------- diff --git a/astlib/location.ml b/astlib/location.ml index 1be55d094..5a2b182c6 100644 --- a/astlib/location.ml +++ b/astlib/location.ml @@ -3,6 +3,10 @@ include Ocaml_common.Location let set_input_name name = input_name := name let set_input_lexbuf lexbuf_opt = input_lexbuf := lexbuf_opt +let dummy_pos = + (*IF_NOT_AT_LEAST 407 { Lexing.pos_fname = ""; pos_lnum = 1; pos_bol = 0; pos_cnum = -1; } *) + (*IF_AT_LEAST 408 Lexing.dummy_pos *) + module Error = struct [@@@warning "-37"] diff --git a/astlib/location.mli b/astlib/location.mli index 8c31e56eb..11cb639c5 100644 --- a/astlib/location.mli +++ b/astlib/location.mli @@ -52,6 +52,10 @@ val set_input_lexbuf : Lexing.lexbuf option -> unit val none : t (** An arbitrary value of type [t]; describes an empty ghost range. *) +val dummy_pos : Lexing.position +(** A location that is guaranteed to match the compiler's dummy position for + whichever compiler is being used. *) + (** {1 Automatically reporting errors for raised exceptions} *) val register_error_of_exn : (exn -> Error.t option) -> unit diff --git a/src/location.ml b/src/location.ml index 9a43eb8d1..2f09ab86a 100644 --- a/src/location.ml +++ b/src/location.ml @@ -8,8 +8,7 @@ type t = location = { } let in_file name = - (* This position matches the compiler's [dummy_pos]. *) - let loc = { pos_fname = name; pos_lnum = 0; pos_bol = 0; pos_cnum = -1 } in + let loc = { L.dummy_pos with pos_fname = name } in { loc_start = loc; loc_end = loc; loc_ghost = true } let set_filename loc fn = diff --git a/test/metaquot/test.ml b/test/metaquot/test.ml index 52a2b2666..0e1001503 100644 --- a/test/metaquot/test.ml +++ b/test/metaquot/test.ml @@ -2,9 +2,9 @@ let loc = Ppxlib.Location.none [%%expect{| val loc : Warnings.loc = {Ppxlib.Location.loc_start = - {Lexing.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; pos_cnum = -1}; + {Lexing.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Lexing.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; pos_cnum = -1}; + {Lexing.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true} |}] @@ -18,19 +18,19 @@ let _ = [%expr ()] ({Ppxlib_ast.Ast.txt = Ppxlib_ast.Ast.Lident "()"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}, None); pexp_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; pexp_loc_stack = []; pexp_attributes = []} @@ -44,19 +44,19 @@ let _ = [%pat? ()] ({Ppxlib_ast.Ast.txt = Ppxlib_ast.Ast.Lident "()"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}, None); ppat_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; ppat_loc_stack = []; ppat_attributes = []} @@ -70,19 +70,19 @@ let _ = [%type: unit] ({Ppxlib_ast.Ast.txt = Ppxlib_ast.Ast.Lident "unit"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}, []); ptyp_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; ptyp_loc_stack = []; ptyp_attributes = []} @@ -97,10 +97,10 @@ let _ = [%stri let _ = ()] {Ppxlib_ast.Ast.ppat_desc = Ppxlib_ast.Ast.Ppat_any; ppat_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; ppat_loc_stack = []; ppat_attributes = []}; @@ -110,37 +110,37 @@ let _ = [%stri let _ = ()] ({Ppxlib_ast.Ast.txt = Ppxlib_ast.Ast.Lident "()"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}, None); pexp_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; pexp_loc_stack = []; pexp_attributes = []}; pvb_attributes = []; pvb_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}]); pstr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}} |}] @@ -156,36 +156,36 @@ let _ = [%sigi: include S] {Ppxlib_ast.Ast.txt = Ppxlib_ast.Ast.Lident "S"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; pmty_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; pmty_attributes = []}; pincl_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; pincl_attributes = []}; psig_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}} |}] @@ -199,10 +199,10 @@ let _ = [%str let _ = ()] {Ppxlib_ast.Ast.ppat_desc = Ppxlib_ast.Ast.Ppat_any; ppat_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; ppat_loc_stack = []; ppat_attributes = []}; @@ -212,37 +212,37 @@ let _ = [%str let _ = ()] ({Ppxlib_ast.Ast.txt = Ppxlib_ast.Ast.Lident "()"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}, None); pexp_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; pexp_loc_stack = []; pexp_attributes = []}; pvb_attributes = []; pvb_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}]); pstr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}] |}] @@ -258,36 +258,36 @@ let _ = [%sig: include S] {Ppxlib_ast.Ast.txt = Ppxlib_ast.Ast.Lident "S"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; pmty_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; pmty_attributes = []}; pincl_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}; pincl_attributes = []}; psig_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}] |}] @@ -303,38 +303,38 @@ let _ = {Ppxlib_ast.Ast.txt = "attr1"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; {Ppxlib_ast.Ast.attr_name = {Ppxlib_ast.Ast.txt = "attr2"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}] |}] @@ -348,38 +348,38 @@ let _ = {Ppxlib_ast.Ast.txt = "attr1"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; {Ppxlib_ast.Ast.attr_name = {Ppxlib_ast.Ast.txt = "attr2"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}] |}] @@ -393,38 +393,38 @@ let _ = {Ppxlib_ast.Ast.txt = "attr1"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; {Ppxlib_ast.Ast.attr_name = {Ppxlib_ast.Ast.txt = "attr2"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}] |}] @@ -443,38 +443,38 @@ let _ = {Ppxlib_ast.Ast.txt = "attr1"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; {Ppxlib_ast.Ast.attr_name = {Ppxlib_ast.Ast.txt = "attr2"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}] |}] @@ -493,38 +493,38 @@ let _ = {Ppxlib_ast.Ast.txt = "attr1"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; {Ppxlib_ast.Ast.attr_name = {Ppxlib_ast.Ast.txt = "attr2"; loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}; attr_payload = Ppxlib_ast.Ast.PStr []; attr_loc = {Ppxlib_ast.Ast.loc_start = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; + {Ppxlib_ast.Ast.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true}}] |}] diff --git a/test/type_is_recursive/test.ml b/test/type_is_recursive/test.ml index 8f24b81f0..ae7a75e1f 100644 --- a/test/type_is_recursive/test.ml +++ b/test/type_is_recursive/test.ml @@ -14,9 +14,9 @@ let loc = Location.none [%%expect{| val loc : location = {Ppxlib.Location.loc_start = - {Lexing.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; pos_cnum = -1}; + {Lexing.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_end = - {Lexing.pos_fname = "_none_"; pos_lnum = 1; pos_bol = 0; pos_cnum = -1}; + {Lexing.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1}; loc_ghost = true} |}]