From 2f5645af44c10d8d8022f7dee20d492008d6af8a Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Mon, 6 Mar 2023 09:28:58 +0100 Subject: [PATCH 01/13] Add history entry. --- HISTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.md b/HISTORY.md index 9144831a0..05e6ba089 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,7 @@ ## 3.9 (unreleased) - Fix missing patterns around contraint pattern (a pattern with a type annotation). +- Make &, &&, |, ||, ++, and :: operators left associative. ## 3.8.2 From b6e1805daee7a29a597ca65e06ae069126a71eee Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Thu, 16 Mar 2023 22:02:58 +0100 Subject: [PATCH 02/13] wip: pprint experiment --- Makefile | 4 + esy.json | 5 +- .../expected_output/patternMatching2.re | 335 +++++++++++++ reason.opam | 1 + src/reason-parser/.ocamlformat | 0 src/reason-parser/dune | 3 +- src/reason-parser/reason_pprint_ast_pprint.ml | 463 ++++++++++++++++++ .../reason_pprint_ast_pprint.mli | 17 + src/reason-parser/reason_toolchain_reason.ml | 5 +- src/rtop/dune | 2 +- 10 files changed, 830 insertions(+), 5 deletions(-) create mode 100644 formatTest/typeCheckedTests/expected_output/patternMatching2.re create mode 100644 src/reason-parser/.ocamlformat create mode 100644 src/reason-parser/reason_pprint_ast_pprint.ml create mode 100644 src/reason-parser/reason_pprint_ast_pprint.mli diff --git a/Makefile b/Makefile index 86d88ef2b..5bcd1bebb 100644 --- a/Makefile +++ b/Makefile @@ -90,3 +90,7 @@ all-supported-ocaml-versions: dune build @install @runtest --root . .PHONY: all-supported-ocaml-versions + +sandertest: + ocamlformat src/reason-parser/reason_pprint_ast_pprint.ml -i + esy x refmt --parse re ./formatTest/typeCheckedTests/input/patternMatching.re --print re > formatTest/typeCheckedTests/expected_output/patternMatching2.re diff --git a/esy.json b/esy.json index e73e58bc7..38c3b50ad 100644 --- a/esy.json +++ b/esy.json @@ -5,11 +5,12 @@ "license": "MIT", "version": "3.8.1", "dependencies": { + "@opam/pprint": "*", "@opam/dune": "2.9.3", "@opam/fix": "*", "@opam/menhir": " >= 20180523.0.0", "@opam/merlin-extend": " >= 0.6", - "@opam/ocamlfind": "*", + "@opam/ocamlfind": "1.9.1", "@opam/ppx_derivers": "< 2.0.0", "@opam/result": "*", "@opam/utop": " >= 1.17.0", @@ -43,7 +44,7 @@ "@opam/camomile", "@opam/lambda-term", "@opam/lwt", "@opam/lwt_log", "@opam/lwt_react", "@opam/menhir", "@opam/mmap", "@opam/ocplib-endian", "@opam/ocamlfind", "@opam/ppx_derivers", - "@opam/react", "@opam/result", "@opam/seq", "@opam/charInfo_width", + "@opam/react", "@opam/result", "@opam/seq", "@opam/charInfo_width", "@opam/pprint", "@opam/utop", "@opam/zed", "ocaml" ], "rewritePrefix": true diff --git a/formatTest/typeCheckedTests/expected_output/patternMatching2.re b/formatTest/typeCheckedTests/expected_output/patternMatching2.re new file mode 100644 index 000000000..b4fbdb641 --- /dev/null +++ b/formatTest/typeCheckedTests/expected_output/patternMatching2.re @@ -0,0 +1,335 @@ +type point = { + x: int, + y: int, +}; + +let id = x => x; + +type myVariant = + | TwoCombos(inner, inner) + | Short + | AlsoHasARecord(int, int, point) +and inner = + | Unused + | HeresTwoConstructorArguments(int, int); + +let computeTuple = (a, b, c, d, e, f, g, h) => ( + a + b, + c + d, + e + f, + g + h, +); + +let res = + switch (TwoCombos(Unused, Unused)) { + | TwoCombos( + HeresTwoConstructorArguments(x, y), + HeresTwoConstructorArguments(a, b), + ) => ( + x, + y, + a, + b, + ) + | TwoCombos(_, _) => (0, 0, 0, 0) + | Short + | AlsoHasARecord(300, _, _) => ( + 100000, + 100000, + 100000, + 100000, + ) + | AlsoHasARecord(firstItem, two, {x, y}) => + computeTuple( + firstItem, + firstItem, + firstItem, + firstItem, + firstItem, + two, + two, + two, + ) + }; + +/** + * Match bodies may include sequence expressions, but without the `{}` + * braces required. + */ +let res = + switch (TwoCombos(Unused, Unused)) { + | TwoCombos( + HeresTwoConstructorArguments(x, y), + HeresTwoConstructorArguments(a, b), + ) => + let ret = (x, y, a, b); + ret; + | TwoCombos(_, _) => + /** + * See, no braces required - saves indentation as well! + */ + let ret = (0, 0, 0, 0); + ret; + | Short + | AlsoHasARecord(300, _, _) => + /** + * And no final semicolon is required. + */ + let ret = (100000, 100000, 100000, 100000); + ret; + | AlsoHasARecord(firstItem, two, {x, y}) => + computeTuple( + firstItem, + firstItem, + firstItem, + firstItem, + firstItem, + two, + two, + two, + ) + }; + +/** + * Ensure that nested Pexp_functions are correctly wrapped in parens. + * + */ +let res = + switch (TwoCombos(Unused, Unused)) { + | TwoCombos( + HeresTwoConstructorArguments(x, y), + HeresTwoConstructorArguments(a, b), + ) => ( + fun + | Some(x) => x + 1 + | None => 0 + ) + | TwoCombos(_, _) => + let x = ( + fun + | Some(x) => x + 1 + | None => 0 + ); + x; + | Short + | AlsoHasARecord(300, _, _) => + id( + fun + | Some(x) => x + 1 + | None => 0 + , + ) + | AlsoHasARecord(firstItem, two, {x, y}) => + id( + fun + | Some(x) => x + 1 + | None => 0 + , + ) + }; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + +type foo = | Foo(unit); + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (Some(1)) { +| Some(1) => 1 +| None => 2 +| _ => 3 +}; + +let myInt = 100; + +todo attributelet rangeInt = 0; + +let myChar = 'x'; + +let rangeChar = + switch (myChar) { + | todo: Ppat_interval => "a to b" + | todo: Ppat_interval => "b to z" + | c => "something else" + }; + + +switch (None) { +| Some([]) => () +| Some(::(_, [])) => () +| Some(::(x, [])) => () +| Some(::(x, xs)) => () +| Some(::(x, ::(y, ::(z, [])))) => () +| _ => () +}; + + +switch (None) { +| Some([]) => () +| Some(::(_, [])) => () +| Some(::(x, [])) => () +| Some(::(x, xs)) => () +| Some(::(x, ::(y, ::(z, [])))) => () +| _ => () +}; + + +switch (None) { +| Some(todo: Ppat_array) => "empty" +| Some(todo: Ppat_array) => "one any" +| Some(todo: Ppat_array) => "one" +| Some(todo: Ppat_array) => "two" +| _ => "many" +}; + + +switch (None) { +| Some(todo: Ppat_array) => "empty" +| Some(todo: Ppat_array) => "one any" +| Some(todo: Ppat_array) => "one" +| Some(todo: Ppat_array) => "two" +| _ => "many" +}; + + +switch (None) { +| Some({x}) => () +| Some({x, y}) => () +| _ => () +}; + + +switch (None) { +| Some({x}) => () +| Some({x, y}) => () +| _ => () +}; + + +switch (None) { +| Some(todo: Ppat_array) => () +| _ => () +}; + + +switch (None) { +| Some( + (someSuperLongString, thisShouldBreakTheLine), + ) => () +| _ => () +}; + + +switch (None) { +| Some( + ::( + someSuperLongString, + ::(thisShouldBreakTheLine, []), + ), + ) => () +| Some( + ::( + someSuperLongString, + es6ListSugarLikeSyntaxWhichIsSuperLong, + ), + ) => () +| Some( + ::( + someSuperLongString, + es6ListSugarLikeSyntaxWhichIsSuperLong, + ), + ) => () +| _ => () +}; + +type aOrB = + | A(int) + | B(int); + +let todo: Ppat_constraint = 0; + +let todo: Ppat_constraint = A(0); + +type test_foo = + | VariantType1 + | VariantType2; + +let branch_with_variant_and_annotation = ( + fun + | todo: Ppat_constraint => true + | VariantType2 => false +); + +type intRange = { + from: string1, + to_: string1, +}; + +type optIntRange = todo: ptype_abstract; + +let optIntRangeOfIntRange = ( + fun + | todo: Ppat_constraint => todo Pexp_constraint + | {from, to_} => Some(todo Pexp_record) +); diff --git a/reason.opam b/reason.opam index fb3770113..899490f28 100644 --- a/reason.opam +++ b/reason.opam @@ -17,6 +17,7 @@ depends: [ "menhir" {>= "20180523"} "merlin-extend" {>= "0.6"} "fix" + "pprint" "result" "ppx_derivers" ] diff --git a/src/reason-parser/.ocamlformat b/src/reason-parser/.ocamlformat new file mode 100644 index 000000000..e69de29bb diff --git a/src/reason-parser/dune b/src/reason-parser/dune index 288f79805..8e3872277 100644 --- a/src/reason-parser/dune +++ b/src/reason-parser/dune @@ -138,6 +138,7 @@ reason_toolchain reason_config reason_pprint_ast + reason_pprint_ast_pprint reason_errors reason_parser_def reason_parser @@ -151,4 +152,4 @@ reason_parser_explain_raw reason_parser_explain reason_parser_recover) - (libraries reason.ocaml-migrate-parsetree menhirLib reason.easy_format)) + (libraries reason.ocaml-migrate-parsetree menhirLib reason.easy_format pprint)) diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml new file mode 100644 index 000000000..33e214e06 --- /dev/null +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -0,0 +1,463 @@ +open Reason_omp +open Ast_411 +open Asttypes +open Location +open Longident +open Parsetree +open Reason_syntax_util +open Reason_attributes +open PPrint + +let infix_symbols = + [ '='; '<'; '>'; '@'; '^'; '|'; '&'; '+'; '-'; '*'; '/'; '$'; '%'; '\\'; '#' ] + +(* this should match "kwdopchar" from reason_declarative_lexer.mll *) +let special_infix_strings = + [ "asr"; "land"; "lor"; "lsl"; "lsr"; "lxor"; "mod"; "or"; ":="; "!="; "!==" ] + +let isInfix i = List.mem i.[0] infix_symbols || List.mem i special_infix_strings + +type funcApplicationLabelStyle = + (* No attaching to the label, but if the entire application fits on one line, + the entire application will appear next to the label as you 'd expect. *) + | NeverWrapFinalItem + (* Attach the first term if there are exactly two terms involved in the + application. + + let x = firstTerm (secondTerm_1 secondTerm_2) thirdTerm; + + Ideally, we'd be able to attach all but the last argument into the label any + time all but the last term will fit - and *not* when (attaching all but + the last term isn't enough to prevent a wrap) - But there's no way to tell + ahead of time if it would prevent a wrap. + + However, the number two is somewhat convenient. This models the + indentation that you'd prefer in non-curried syntax languages like + JavaScript, where application only ever has two terms. + *) + | WrapFinalListyItemIfFewerThan of int + +type formatSettings = { + (* Whether or not to expect that the original parser that generated the AST + would have annotated constructor argument tuples with explicit arity to + indicate that they are multiple arguments. (True if parsed in original + OCaml AST, false if using Reason parser). + *) + constructorTupleImplicitArity : bool; + space : int; + (* For curried arguments in function *definitions* only: Number of [space]s + to offset beyond the [let] keyword. Default 1. + *) + listsRecordsIndent : int; + indentWrappedPatternArgs : int; + indentMatchCases : int; + (* Amount to indent in label-like constructs such as wrapped function + applications, etc - or even record fields. This is not the same concept as an + indented curried argument list. *) + indentAfterLabels : int; + (* Amount to indent after the opening brace of switch/try. + Here's an example of what it would look like w/ [trySwitchIndent = 2]: + Sticks the expression to the last item in a sequence in several [X | Y | Z + => expr], and forces X, Y, Z to be split onto several lines. (Otherwise, + sticking to Z would result in hanging expressions). TODO: In the first case, + it's clear that we want patterns to have an "extra" indentation with matching + in a "match". Create extra config param to pass to [self#pattern] for extra + indentation in this one case. + + switch x { + | TwoCombos + (HeresTwoConstructorArguments x y) + (HeresTwoConstructorArguments a b) => + ((a + b) + x) + y; + | Short + | AlsoHasARecord a b {x, y} => ( + retOne, + retTwo + ) + | AlsoHasARecord a b {x, y} => + callMyFunction + withArg + withArg + withArg + withArg; + } + *) + trySwitchIndent : int; + (* In the case of two term function application (when flattened), the first + term should become part of the label, and the second term should be able to wrap + This doesn't effect n != 2. + + [true] + let x = reallyShort allFitsOnOneLine; + let x = someFunction { + reallyLongObject: true, + thatWouldntFitOnThe: true, + firstLine: true + }; + + [false] + let x = reallyShort allFitsOnOneLine; + let x = + someFunction + { + reallyLongObject: true, + thatWouldntFitOnThe: true, + firstLine: true + }; + *) + funcApplicationLabelStyle : funcApplicationLabelStyle; + funcCurriedPatternStyle : funcApplicationLabelStyle; + width : int; + assumeExplicitArity : bool; + constructorLists : string list; +} + +let defaultSettings = + { + constructorTupleImplicitArity = false; + space = 1; + listsRecordsIndent = 2; + indentWrappedPatternArgs = 2; + indentMatchCases = 2; + indentAfterLabels = 2; + trySwitchIndent = 0; + funcApplicationLabelStyle = WrapFinalListyItemIfFewerThan 3; + (* WrapFinalListyItemIfFewerThan is currently a bad idea for curried + arguments: It looks great in some cases: + + let myFun (a:int) :( + int, + string + ) => (a, "this is a"); + + But horrible in others: + + let myFun + { + myField, + yourField + } :someReturnType => myField + yourField; + + let myFun + { // Curried arg wraps + myField, + yourField + } : ( // But the last is "listy" so it docks + int, // To the [let]. + int, + int + ) => myField + yourField; + + We probably want some special listy label docking/wrapping mode for + curried function bindings. + *) + funcCurriedPatternStyle = NeverWrapFinalItem; + width = 80; + assumeExplicitArity = false; + constructorLists = []; + } + +let configuredSettings = ref defaultSettings + +let configure ~width ~assumeExplicitArity ~constructorLists = + configuredSettings := + { defaultSettings with width; assumeExplicitArity; constructorLists } + +let rec structure_item term = + match term.pstr_desc with + | Pstr_eval (e, a) -> group (expression e ^^ semi) + | Pstr_value (rf, vb) -> value_bindings rf vb + | Pstr_primitive v -> string "todo Pstr_primitive" + | Pstr_type (r, tl) -> + group + (string "type" ^^ space + ^^ separate_map + (space ^^ hardline ^^ string "and" ^^ space) + type_declaration tl + ^^ semi) + | Pstr_typext t -> string "todo Pstr_typext" + | Pstr_exception e -> string "todo Pstr_exception" + | Pstr_module mb -> string "todo Pstr_module" + | Pstr_recmodule ml -> string "todo Pstr_recmodule" + | Pstr_modtype mt -> string "todo Pstr_modtype" + | Pstr_open o -> string "todo Pstr_open" + | Pstr_class cl -> string "todo Pstr_class" + | Pstr_class_type cl -> string "todo Pstr_class_type" + | Pstr_include i -> string "todo Pstr_include" + | Pstr_attribute a -> string "todo Pstr_attribute" + | Pstr_extension (e, a) -> string "todo Pstr_extension" + +and value_bindings rf vb = + let attrs = List.map (fun b -> partitionAttributes b.pvb_attributes) vb in + let fstAttrs, restAttrs = + match attrs with hd :: tl -> (hd, tl) | _ -> failwith "not supported" + in + + concat_map attribute fstAttrs.docAttrs + ^^ concat_map attribute fstAttrs.stdAttrs + ^^ string "let" ^^ space + ^^ (match rf with Nonrecursive -> empty | Recursive -> string "rec") + ^^ separate_map (space ^^ hardline ^^ string "and" ^^ space) value_binding vb + +and attribute = function + | { + attr_name = { Location.txt = "ocaml.doc" | "ocaml.text" }; + attr_payload = + PStr + [ + { + pstr_desc = + Pstr_eval + ( { pexp_desc = Pexp_constant (Pconst_string (text, _, None)) }, + _ ); + pstr_loc; + }; + ]; + _; + } -> + let text = if text = "" then "/**/" else "/**" ^ text ^ "*/" in + string text ^^ hardline + | { attr_name; attr_payload; _ } -> + string "todo attribute" (* self#payload "@" attr_name attr_payload *) + +and value_binding { pvb_pat; pvb_expr; pvb_attributes; pvb_loc } = + group + (pattern pvb_pat ^^ space ^^ equals ^^ space + ^^ group (expression ~depth:2 pvb_expr) + ^^ semi) + +and arg_label = function + | Nolabel -> empty + | Labelled s -> string "todo: Labelled" + | Optional s -> string "todo: optional" + +and arrow = space ^^ equals ^^ rangle ^^ space + +and constant c = + let open OCaml in + match c with + | Pconst_char i -> char i + | Pconst_string (i, _, None) -> string i + | Pconst_string (i, _, Some delim) -> + string (Format.sprintf "{%s|%s|%s}" delim i delim) + | Pconst_integer (i, None) -> int (int_of_string i) + | Pconst_integer (i, Some m) -> int (int_of_string i) + | Pconst_float (i, None) -> float (float_of_string i) + | Pconst_float (i, Some m) -> float (float_of_string i) + +and expression ?(depth = 0) ?(wrap = true) + { pexp_desc; pexp_loc; pexp_loc_stack; pexp_attributes } = + match pexp_desc with + | Pexp_ident { txt = Lident l } -> string l + | Pexp_ident _ -> string "todo pexident" + | Pexp_constant c -> constant c + | Pexp_let (rf, vb, e) -> + break 0 ^^ value_bindings rf vb ^^ break 1 ^^ expression e ^^ semi + | Pexp_function cl -> + let lparen, rparen = + if wrap then (lparen ^^ break 0, rparen) else (empty, empty) + in + nest 2 + (lparen ^^ string "fun" ^^ break 0 ^^ bar ^^ space + ^^ separate_map (hardline ^^ bar ^^ space) case cl) + ^^ break 0 ^^ rparen + | Pexp_fun (a, e, p, e2) -> + let rec args p result = + match p.pexp_desc with + | Pexp_fun (a, e, p, e2) -> args e2 (pattern p :: result) + | _ -> expression p :: result + in + let args = args e2 [ pattern p ] in + let args, callback = + match args with + | callback :: [ e ] -> (e, callback) + | callback :: lst -> + (parens (separate (comma ^^ space) (List.rev lst)), callback) + | _ -> (string "pepxfun: not supported yet", string "not supported yet") + in + arg_label a ^^ args ^^ arrow ^^ callback + | Pexp_apply + ( ({ pexp_desc = Pexp_ident { txt = Lident i; _ }; _ } as infixOperator), + [ (_, a); (_, b) ] ) + when isInfix i -> + expression a ^^ space ^^ expression infixOperator ^^ space ^^ expression b + | Pexp_apply (e, l) -> + break 0 ^^ expression e ^^ string "(" + ^^ nest 2 + (break 0 + ^^ separate_map + (comma ^^ break 1) + (fun (_, e) -> expression ~wrap:false e) + l + ^^ ifflat empty comma) + ^^ break 0 ^^ string ")" + | Pexp_match (e, cl) -> + group + (nest depth + (break 1 ^^ string "switch" ^^ space + ^^ parens (expression e) + ^^ space ^^ lbrace ^^ hardline ^^ bar ^^ space + ^^ separate_map (hardline ^^ bar ^^ space) case cl + ^^ break 0 ^^ rbrace)) + | Pexp_try (e, cl) -> string "todo Pexp_try" + | Pexp_tuple el -> + nest 2 + (lparen ^^ break 0 + ^^ separate_map (comma ^^ break 1) expression el + ^^ ifflat empty comma) + ^^ break 0 ^^ rparen + | Pexp_construct ({ txt = Lident s1 }, opt) -> + group (string s1 ^^ optional expression opt) + | Pexp_construct (_, opt) -> string "todo Pexp_construct" + | Pexp_variant (l, e) -> string "todo Pexp_variant" + | Pexp_record (l, e) -> string "todo Pexp_record" + | Pexp_field (e, l) -> string "todo Pexp_field" + | Pexp_setfield (e, l, e2) -> string "todo Pexp_setfield" + | Pexp_array el -> string "todo Pexp_array" + | Pexp_ifthenelse (e1, e2, e3) -> string "todo Pexp_ifthenelse" + | Pexp_sequence (e1, e2) -> string "todo Pexp_sequence" + | Pexp_while (e1, e2) -> string "todo Pexp_while" + | Pexp_for (p, e1, e2, d, e3) -> string "todo Pexp_for" + | Pexp_constraint (e1, ct) -> string "todo Pexp_constraint" + | Pexp_coerce (e, c, c2) -> string "todo Pexp_coerce" + | Pexp_send (e, l) -> string "todo Pexp_send" + | Pexp_new l -> string "todo Pexp_new" + | Pexp_setinstvar (l, e) -> string "todo Pexp_setinstvar" + | Pexp_override l -> string "todo Pexp_override" + | Pexp_letmodule (s, m, e) -> string "todo Pexp_letmodule" + | Pexp_letexception (ec, e) -> string "todo Pexp_letexception" + | Pexp_assert e -> string "todo Pexp_assert" + | Pexp_lazy e -> string "todo Pexp_lazy" + | Pexp_poly (e, ct) -> string "todo Pexp_poly" + | Pexp_object c -> string "todo Pexp_object" + | Pexp_newtype (s, e) -> string "todo Pexp_newtype" + | Pexp_pack m -> string "todo Pexp_pack" + | Pexp_open (o, e) -> string "todo Pexp_open" + | Pexp_letop l -> string "todo Pexp_letop" + | Pexp_extension e -> string "todo Pexp_extension" + | Pexp_unreachable -> string "todo Pexp_unreachable" + +and case { pc_lhs; pc_guard; pc_rhs } = + let depth = match pc_lhs.ppat_desc with Ppat_or (_, _) -> 0 | _ -> 2 in + group (nest depth (pattern pc_lhs) ^^ arrow ^^ nest 2 (expression pc_rhs)) + +and pattern { ppat_desc; ppat_loc; ppat_loc_stack; ppat_attributes } = + match ppat_desc with + | Ppat_var v -> string v.txt + | Ppat_any -> underscore + | Ppat_alias (p, l) -> string "todo: Ppat_alias" + | Ppat_constant c -> constant c + | Ppat_interval (c, c2) -> string "todo: Ppat_interval" + | Ppat_tuple pl -> + group + (nest 2 (lparen ^^ break 0 ^^ separate_map (comma ^^ break 1) pattern pl) + ^^ ifflat empty comma ^^ break 0 ^^ rparen) + | Ppat_construct ({ txt = Lident s }, c) -> string s ^^ optional pattern c + | Ppat_construct (s, s2) -> string "todo Ppatconstruct" + | Ppat_variant (l, po) -> string "todo: Ppat_variant" + | Ppat_record (pl, c) -> + group + (nest 2 + (lbrace ^^ break 0 + ^^ separate_map (comma ^^ break 1) (fun (_, p) -> pattern p) pl) + ^^ ifflat empty comma ^^ break 0 ^^ rbrace) + | Ppat_array pl -> string "todo: Ppat_array" + | Ppat_or (p, p2) -> pattern p ^^ hardline ^^ bar ^^ space ^^ pattern p2 + | Ppat_constraint (p, c) -> string "todo: Ppat_constraint" + | Ppat_type l -> string "todo: Ppat_type" + | Ppat_lazy p -> string "todo: Ppat_lazy" + | Ppat_unpack l -> string "todo: Ppat_unpack" + | Ppat_exception p -> string "todo: Ppat_exception" + | Ppat_extension e -> string "todo: Ppat_extension" + | Ppat_open (l, p) -> string "todo: Ppat_open" + +and type_declaration + { + ptype_name; + ptype_params; + ptype_cstrs; + ptype_kind; + ptype_private; + ptype_manifest; + ptype_attributes; + ptype_loc; + } = + group + (string ptype_name.txt ^^ space ^^ string "=" ^^ space + ^^ type_kind ptype_kind) + +and type_kind = function + | Ptype_record ll -> + (* ifflat + (braces (separate_map (comma ^^ blank 1) label_declaration ll)) *) + string "{" + ^^ nest 2 + (hardline ^^ separate_map (comma ^^ hardline) label_declaration ll) + ^^ comma ^^ break 1 ^^ string "}" + (* braces (nest 2 (hardline ^^ separate_map (comma ^^ blank 1) label_declaration ll)) *) + | Ptype_variant cl -> + nest 2 (break 1 ^^ separate_map hardline constructor_declaration cl) + | Ptype_abstract -> string "todo: ptype_abstract" + | Ptype_open -> string "todo: Ptype_open" + +and constructor_declaration { pcd_name; pcd_args; pcd_res; _ } = + bar ^^ space ^^ string pcd_name.txt ^^ constructor_argument pcd_args + +and constructor_argument = function + | Pcstr_tuple [] -> empty + | Pcstr_tuple l -> parens (separate_map (comma ^^ blank 1) core_type l) + | Pcstr_record l -> space ^^ braces (separate_map comma label_declaration l) + +and label_declaration { pld_name; pld_type; _ } = + group (string pld_name.txt ^^ string ":" ^^ space ^^ core_type pld_type) + +and core_type { ptyp_desc; _ } = + match ptyp_desc with + | Ptyp_var _ -> string "todo a" + | Ptyp_constr ({ txt = Lident s1 }, []) -> string s1 + | Ptyp_constr (_, cl) -> + separate_map star core_type cl ^^ string (string_of_int (List.length cl)) + | _ -> string "other type..." + +and structure structureItems = + group (separate_map (hardline ^^ hardline) structure_item structureItems) + +let createFormatter () = + let module RFormatter = struct + let case_list : Format.formatter -> case list -> unit = fun f l -> () + let core_type : Format.formatter -> core_type -> unit = fun f c -> () + let expression : Format.formatter -> expression -> unit = fun f e -> () + let pattern : Format.formatter -> pattern -> unit = fun f p -> () + + let signature : + Reason_comment.t list -> Format.formatter -> signature -> unit = + fun l f s -> () + + let structure : + Reason_comment.t list -> Format.formatter -> structure -> unit = + fun comments ppf x -> + let buf = Buffer.create 100 in + let width = 50 in + let doc = structure x in + (* PPrint.ToFormatter.pretty 1.0 width ppf doc *) + PPrint.ToBuffer.pretty 1.0 width buf doc; + print_endline (Buffer.contents buf) + (* List.iter (fun comment -> printer#trackComment comment) comments; *) + (* format_layout ppf ~comments *) + (* (printer#structure (apply_mapper_to_structure x preprocessing_mapper)) *) + (* (printer#structure x) *) + + let toplevel_phrase : Format.formatter -> toplevel_phrase -> unit = + fun f l -> () + end in + object + method core_type = RFormatter.core_type + method pattern = RFormatter.pattern + method signature = RFormatter.signature + method structure = RFormatter.structure + + (* For merlin-destruct *) + method toplevel_phrase = RFormatter.toplevel_phrase + method expression = RFormatter.expression + method case_list = RFormatter.case_list + end diff --git a/src/reason-parser/reason_pprint_ast_pprint.mli b/src/reason-parser/reason_pprint_ast_pprint.mli new file mode 100644 index 000000000..932569e8f --- /dev/null +++ b/src/reason-parser/reason_pprint_ast_pprint.mli @@ -0,0 +1,17 @@ +open Reason_omp +open Ast_411.Parsetree + +val configure : + width:int -> + assumeExplicitArity:bool -> constructorLists:string list -> unit + +val createFormatter : unit -> + < + case_list : Format.formatter -> case list -> unit; + core_type : Format.formatter -> core_type -> unit; + expression : Format.formatter -> expression -> unit; + pattern : Format.formatter -> pattern -> unit; + signature : Reason_comment.t list -> Format.formatter -> signature -> unit; + structure : Reason_comment.t list -> Format.formatter -> structure -> unit; + toplevel_phrase : Format.formatter -> toplevel_phrase -> unit; + > diff --git a/src/reason-parser/reason_toolchain_reason.ml b/src/reason-parser/reason_toolchain_reason.ml index 1a6c4dcf2..02c2664e4 100644 --- a/src/reason-parser/reason_toolchain_reason.ml +++ b/src/reason-parser/reason_toolchain_reason.ml @@ -89,5 +89,8 @@ let format_interface_with_comments (signature, comments) formatter = let reason_formatter = Reason_pprint_ast.createFormatter () in reason_formatter#signature comments formatter signature let format_implementation_with_comments (implementation, comments) formatter = + let reason_formatter_pprint = Reason_pprint_ast_pprint.createFormatter () in + reason_formatter_pprint#structure comments formatter implementation; + (* let _ = print_endline "after = " in let reason_formatter = Reason_pprint_ast.createFormatter () in - reason_formatter#structure comments formatter implementation + reason_formatter#structure comments formatter implementation *) diff --git a/src/rtop/dune b/src/rtop/dune index 729cc19da..ea76d0f9e 100644 --- a/src/rtop/dune +++ b/src/rtop/dune @@ -4,7 +4,7 @@ (modules reason_util reason_utop reason_toploop) (wrapped false) (modes byte) - (libraries compiler-libs.common menhirLib reason.easy_format reason utop reason.ocaml-migrate-parsetree)) + (libraries compiler-libs.common menhirLib reason.easy_format reason utop reason.ocaml-migrate-parsetree pprint)) (executable (name rtop) From ca8d8fd4ff2025ab3265cc7d58db832a6761ad49 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Wed, 22 Mar 2023 14:33:01 +0100 Subject: [PATCH 03/13] Remove accidental history change. --- HISTORY.md | 1 - 1 file changed, 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 05e6ba089..9144831a0 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,7 +1,6 @@ ## 3.9 (unreleased) - Fix missing patterns around contraint pattern (a pattern with a type annotation). -- Make &, &&, |, ||, ++, and :: operators left associative. ## 3.8.2 From 825fb3a1d641285a3784972e71983723bc69f458 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Sat, 25 Mar 2023 16:51:18 +0100 Subject: [PATCH 04/13] wip: print more --- .../expected_output/patternMatching2.re | 139 ++++++++-------- src/reason-parser/reason_pprint_ast_pprint.ml | 153 ++++++++++++++---- 2 files changed, 186 insertions(+), 106 deletions(-) diff --git a/formatTest/typeCheckedTests/expected_output/patternMatching2.re b/formatTest/typeCheckedTests/expected_output/patternMatching2.re index b4fbdb641..d07588f16 100644 --- a/formatTest/typeCheckedTests/expected_output/patternMatching2.re +++ b/formatTest/typeCheckedTests/expected_output/patternMatching2.re @@ -99,11 +99,9 @@ let res = | TwoCombos( HeresTwoConstructorArguments(x, y), HeresTwoConstructorArguments(a, b), - ) => ( - fun - | Some(x) => x + 1 - | None => 0 - ) + ) => fun + | Some(x) => x + 1 + | None => 0 | TwoCombos(_, _) => let x = ( fun @@ -115,82 +113,80 @@ let res = | AlsoHasARecord(300, _, _) => id( fun - | Some(x) => x + 1 - | None => 0 - , + | Some(x) => x + 1 + | None => 0, ) | AlsoHasARecord(firstItem, two, {x, y}) => id( fun - | Some(x) => x + 1 - | None => 0 - , + | Some(x) => x + 1 + | None => 0, ) }; -switch (Some(())) { -| Some(()) => 1 +switch (Some()) { +| Some() => 1 | _ => 2 }; -switch (Some(())) { -| Some(()) => 1 +switch (Some()) { +| Some() => 1 | _ => 2 }; -switch (Some(())) { -| Some(()) => 1 +switch (Some()) { +| Some() => 1 | _ => 2 }; -switch (Some(())) { -| Some(()) => 1 +switch (Some()) { +| Some() => 1 | _ => 2 }; type foo = | Foo(unit); -switch (Foo(())) { -| Foo(()) => 1 +switch (Foo()) { +| Foo() => 1 }; -switch (Foo(())) { -| Foo(()) => 1 +switch (Foo()) { +| Foo() => 1 }; -switch (Foo(())) { -| Foo(()) => 1 +switch (Foo()) { +| Foo() => 1 }; -switch (Foo(())) { -| Foo(()) => 1 +switch (Foo()) { +| Foo() => 1 }; -switch (()) { +switch () { | () => 1 }; -switch (()) { +switch () { | () => 1 }; -switch (()) { +switch () { | () => 1 }; -switch (()) { +switch () { | () => 1 }; @@ -203,72 +199,75 @@ switch (Some(1)) { let myInt = 100; -todo attributelet rangeInt = 0; +[@something1 .. 2 +let rangeInt = 0; let myChar = 'x'; let rangeChar = switch (myChar) { - | todo: Ppat_interval => "a to b" - | todo: Ppat_interval => "b to z" + | 'a' .. 'b' => "a to b" + | 'b' .. 'z' => "b to z" | c => "something else" }; switch (None) { | Some([]) => () -| Some(::(_, [])) => () -| Some(::(x, [])) => () -| Some(::(x, xs)) => () -| Some(::(x, ::(y, ::(z, [])))) => () +| Some([_]) when true => () +| Some([x]) => () +| Some([x, ...xs]) when true => () +| Some([x, y, z]) => () | _ => () }; switch (None) { | Some([]) => () -| Some(::(_, [])) => () -| Some(::(x, [])) => () -| Some(::(x, xs)) => () -| Some(::(x, ::(y, ::(z, [])))) => () +| Some([_]) when true => () +| Some([x]) => () +| Some([x, ...xs]) when true => () +| Some([x, y, z]) => () | _ => () }; switch (None) { -| Some(todo: Ppat_array) => "empty" -| Some(todo: Ppat_array) => "one any" -| Some(todo: Ppat_array) => "one" -| Some(todo: Ppat_array) => "two" +| Some([||]) => "empty" +| Some([|_|]) when true => "one any" +| Some([|a|]) => "one" +| Some([|a, b|]) => "two" | _ => "many" }; switch (None) { -| Some(todo: Ppat_array) => "empty" -| Some(todo: Ppat_array) => "one any" -| Some(todo: Ppat_array) => "one" -| Some(todo: Ppat_array) => "two" +| Some([||]) => "empty" +| Some([|_|]) when true => "one any" +| Some([|a|]) => "one" +| Some([|a, b|]) => "two" | _ => "many" }; switch (None) { -| Some({x}) => () +| Some({x}) when true => () | Some({x, y}) => () | _ => () }; switch (None) { -| Some({x}) => () +| Some({x}) when true => () | Some({x, y}) => () | _ => () }; switch (None) { -| Some(todo: Ppat_array) => () +| Some( + [|someSuperLongString, thisShouldBreakTheLine|], + ) => () | _ => () }; @@ -283,22 +282,13 @@ switch (None) { switch (None) { | Some( - ::( - someSuperLongString, - ::(thisShouldBreakTheLine, []), - ), + [someSuperLongString, thisShouldBreakTheLine], ) => () | Some( - ::( - someSuperLongString, - es6ListSugarLikeSyntaxWhichIsSuperLong, - ), - ) => () + [someSuperLongString, ...es6ListSugarLikeSyntaxWhichIsSuperLong], + ) when true == true => () | Some( - ::( - someSuperLongString, - es6ListSugarLikeSyntaxWhichIsSuperLong, - ), + [someSuperLongString, ...es6ListSugarLikeSyntaxWhichIsSuperLong], ) => () | _ => () }; @@ -307,9 +297,10 @@ type aOrB = | A(int) | B(int); -let todo: Ppat_constraint = 0; +let ((nestedAnnotation: int): int) = 0; -let todo: Ppat_constraint = A(0); +let (A(i) +| B(i): aOrB) = A(0); type test_foo = | VariantType1 @@ -317,19 +308,19 @@ type test_foo = let branch_with_variant_and_annotation = ( fun - | todo: Ppat_constraint => true + | (VariantType1: test_foo) => true | VariantType2 => false ); type intRange = { - from: string1, - to_: string1, + from: option(string), + to_: option(string), }; -type optIntRange = todo: ptype_abstract; +type optIntRange = option(intRange); let optIntRangeOfIntRange = ( fun - | todo: Ppat_constraint => todo Pexp_constraint - | {from, to_} => Some(todo Pexp_record) + | ({from: None, to_: None}: intRange) => (None: optIntRange) + | {from, to_} => Some({from, to_}) ); diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index 33e214e06..eb37be540 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -163,9 +163,15 @@ let configure ~width ~assumeExplicitArity ~constructorLists = configuredSettings := { defaultSettings with width; assumeExplicitArity; constructorLists } +let settings = defaultSettings + let rec structure_item term = match term.pstr_desc with - | Pstr_eval (e, a) -> group (expression e ^^ semi) + | Pstr_eval (e, attrs) -> + let attrs = partitionAttributes attrs in + concat_map attribute attrs.docAttrs + ^^ concat_map attribute attrs.stdAttrs + ^^ group (expression e ^^ semi) | Pstr_value (rf, vb) -> value_bindings rf vb | Pstr_primitive v -> string "todo Pstr_primitive" | Pstr_type (r, tl) -> @@ -218,7 +224,14 @@ and attribute = function let text = if text = "" then "/**/" else "/**" ^ text ^ "*/" in string text ^^ hardline | { attr_name; attr_payload; _ } -> - string "todo attribute" (* self#payload "@" attr_name attr_payload *) + string "[@" ^^ string attr_name.txt ^^ payload attr_payload + ^^ hardline (* self#payload "@" attr_name attr_payload *) + +and payload = function + | PStr s -> structure s + | PSig s -> string "todo payload: sig" + | PTyp t -> string "todo payload: typ" + | PPat (p, eo) -> pattern p ^^ optional expression eo and value_binding { pvb_pat; pvb_expr; pvb_attributes; pvb_loc } = group @@ -254,13 +267,14 @@ and expression ?(depth = 0) ?(wrap = true) | Pexp_let (rf, vb, e) -> break 0 ^^ value_bindings rf vb ^^ break 1 ^^ expression e ^^ semi | Pexp_function cl -> - let lparen, rparen = - if wrap then (lparen ^^ break 0, rparen) else (empty, empty) + let lparen, rparen, n = + if wrap then (lparen ^^ break 0, break 0 ^^ rparen, 2) + else (empty, empty, 0) in - nest 2 + nest n (lparen ^^ string "fun" ^^ break 0 ^^ bar ^^ space ^^ separate_map (hardline ^^ bar ^^ space) case cl) - ^^ break 0 ^^ rparen + ^^ rparen | Pexp_fun (a, e, p, e2) -> let rec args p result = match p.pexp_desc with @@ -282,15 +296,16 @@ and expression ?(depth = 0) ?(wrap = true) when isInfix i -> expression a ^^ space ^^ expression infixOperator ^^ space ^^ expression b | Pexp_apply (e, l) -> - break 0 ^^ expression e ^^ string "(" - ^^ nest 2 - (break 0 - ^^ separate_map - (comma ^^ break 1) - (fun (_, e) -> expression ~wrap:false e) - l - ^^ ifflat empty comma) - ^^ break 0 ^^ string ")" + group + (break 0 ^^ expression e ^^ string "(" + ^^ nest 2 + (break 0 + ^^ separate_map + (comma ^^ break 1) + (fun (_, e) -> expression ~wrap:false e) + l + ^^ ifflat empty comma) + ^^ break 0 ^^ string ")") | Pexp_match (e, cl) -> group (nest depth @@ -306,11 +321,29 @@ and expression ?(depth = 0) ?(wrap = true) ^^ separate_map (comma ^^ break 1) expression el ^^ ifflat empty comma) ^^ break 0 ^^ rparen + | Pexp_construct ({ txt = Lident "()" }, None) -> + if wrap then empty else string "()" | Pexp_construct ({ txt = Lident s1 }, opt) -> - group (string s1 ^^ optional expression opt) + group (string s1 ^^ optional (expression ~wrap:true) opt) | Pexp_construct (_, opt) -> string "todo Pexp_construct" | Pexp_variant (l, e) -> string "todo Pexp_variant" - | Pexp_record (l, e) -> string "todo Pexp_record" + | Pexp_record (l, e) -> + group + (nest 2 + (lbrace ^^ break 0 + ^^ separate_map + (comma ^^ break 1) + (fun (l, e) -> + match l.txt with + | Lident name -> ( + match e with + | { pexp_desc = Pexp_ident { txt = Lident value }; _ } + when name = value -> + string name + | _ -> string name ^^ colon ^^ space ^^ expression e) + | _ -> string "Ppat_record: not supported") + l) + ^^ ifflat empty comma ^^ break 0 ^^ rbrace) | Pexp_field (e, l) -> string "todo Pexp_field" | Pexp_setfield (e, l, e2) -> string "todo Pexp_setfield" | Pexp_array el -> string "todo Pexp_array" @@ -318,7 +351,8 @@ and expression ?(depth = 0) ?(wrap = true) | Pexp_sequence (e1, e2) -> string "todo Pexp_sequence" | Pexp_while (e1, e2) -> string "todo Pexp_while" | Pexp_for (p, e1, e2, d, e3) -> string "todo Pexp_for" - | Pexp_constraint (e1, ct) -> string "todo Pexp_constraint" + | Pexp_constraint (e1, c) -> + lparen ^^ expression e1 ^^ colon ^^ space ^^ core_type c ^^ rparen | Pexp_coerce (e, c, c2) -> string "todo Pexp_coerce" | Pexp_send (e, l) -> string "todo Pexp_send" | Pexp_new l -> string "todo Pexp_new" @@ -339,19 +373,57 @@ and expression ?(depth = 0) ?(wrap = true) and case { pc_lhs; pc_guard; pc_rhs } = let depth = match pc_lhs.ppat_desc with Ppat_or (_, _) -> 0 | _ -> 2 in - group (nest depth (pattern pc_lhs) ^^ arrow ^^ nest 2 (expression pc_rhs)) - -and pattern { ppat_desc; ppat_loc; ppat_loc_stack; ppat_attributes } = + group + (nest depth (pattern ~wrap:false pc_lhs) + ^^ optional + (fun e -> space ^^ string "when" ^^ space ^^ expression e) + pc_guard + ^^ arrow + ^^ nest 2 (expression ~wrap:false pc_rhs)) + +and pattern ?(wrap = true) + ({ ppat_desc; ppat_loc; ppat_loc_stack; ppat_attributes } as px) = match ppat_desc with | Ppat_var v -> string v.txt | Ppat_any -> underscore | Ppat_alias (p, l) -> string "todo: Ppat_alias" | Ppat_constant c -> constant c - | Ppat_interval (c, c2) -> string "todo: Ppat_interval" + | Ppat_interval (c, c2) -> + constant c ^^ space ^^ string ".." ^^ space ^^ constant c2 | Ppat_tuple pl -> group (nest 2 (lparen ^^ break 0 ^^ separate_map (comma ^^ break 1) pattern pl) ^^ ifflat empty comma ^^ break 0 ^^ rparen) + | Ppat_construct ({ txt = Lident "::" }, l) -> ( + let rec list_items_cons acc = function + | { + ppat_desc = + Ppat_construct + ( { txt = Lident "::" }, + Some { ppat_desc = Ppat_tuple [ pat1; pat2 ] } ); + } -> + list_items_cons (pat1 :: acc) pat2 + | p -> (List.rev acc, p) + in + + let pat_list, pat_last = list_items_cons [] px in + match pat_last with + | { ppat_desc = Ppat_construct ({ txt = Lident "[]" }, _) } -> + (* [x,y,z] *) + (* let lwrap, rwrap = wrap in *) + lbracket ^^ separate_map (comma ^^ space) pattern pat_list ^^ rbracket + (* makeList pat_list + ~break:Layout.IfNeed ~sep:commaTrail ~postSpace:true + ~wrap:(lwrap ^ "[", "]" ^ rwrap) *) + | _ -> + (* x::y *) + lbracket + ^^ separate2 (comma ^^ space) + (comma ^^ space ^^ dot ^^ dot ^^ dot) + (List.map pattern (pat_list @ [ pat_last ])) + ^^ rbracket) + | Ppat_construct ({ txt = Lident "()" }, None) -> + if wrap then empty else string "()" | Ppat_construct ({ txt = Lident s }, c) -> string s ^^ optional pattern c | Ppat_construct (s, s2) -> string "todo Ppatconstruct" | Ppat_variant (l, po) -> string "todo: Ppat_variant" @@ -359,11 +431,27 @@ and pattern { ppat_desc; ppat_loc; ppat_loc_stack; ppat_attributes } = group (nest 2 (lbrace ^^ break 0 - ^^ separate_map (comma ^^ break 1) (fun (_, p) -> pattern p) pl) + ^^ separate_map + (comma ^^ break 1) + (fun (l, p) -> + match l.txt with + | Lident name -> ( + match p with + | { ppat_desc = Ppat_var { txt = value }; _ } + when name = value -> + string name + | _ -> string name ^^ colon ^^ space ^^ pattern p) + | _ -> string "Ppat_record: not supported") + pl) ^^ ifflat empty comma ^^ break 0 ^^ rbrace) - | Ppat_array pl -> string "todo: Ppat_array" + | Ppat_array pl -> + group + (lbracket ^^ bar + ^^ separate_map (comma ^^ space) pattern pl + ^^ bar ^^ rbracket) | Ppat_or (p, p2) -> pattern p ^^ hardline ^^ bar ^^ space ^^ pattern p2 - | Ppat_constraint (p, c) -> string "todo: Ppat_constraint" + | Ppat_constraint (p, c) -> + lparen ^^ pattern p ^^ colon ^^ space ^^ core_type c ^^ rparen | Ppat_type l -> string "todo: Ppat_type" | Ppat_lazy p -> string "todo: Ppat_lazy" | Ppat_unpack l -> string "todo: Ppat_unpack" @@ -384,10 +472,10 @@ and type_declaration } = group (string ptype_name.txt ^^ space ^^ string "=" ^^ space - ^^ type_kind ptype_kind) + ^^ type_kind (ptype_kind, ptype_private, ptype_manifest)) and type_kind = function - | Ptype_record ll -> + | Ptype_record ll, _, _ -> (* ifflat (braces (separate_map (comma ^^ blank 1) label_declaration ll)) *) string "{" @@ -395,10 +483,11 @@ and type_kind = function (hardline ^^ separate_map (comma ^^ hardline) label_declaration ll) ^^ comma ^^ break 1 ^^ string "}" (* braces (nest 2 (hardline ^^ separate_map (comma ^^ blank 1) label_declaration ll)) *) - | Ptype_variant cl -> + | Ptype_variant cl, _, _ -> nest 2 (break 1 ^^ separate_map hardline constructor_declaration cl) - | Ptype_abstract -> string "todo: ptype_abstract" - | Ptype_open -> string "todo: Ptype_open" + | Ptype_abstract, Public, Some s -> core_type s + | Ptype_abstract, _, _ -> string "todo: ptype_abstract" + | Ptype_open, _, _ -> string "todo: Ptype_open" and constructor_declaration { pcd_name; pcd_args; pcd_res; _ } = bar ^^ space ^^ string pcd_name.txt ^^ constructor_argument pcd_args @@ -415,8 +504,8 @@ and core_type { ptyp_desc; _ } = match ptyp_desc with | Ptyp_var _ -> string "todo a" | Ptyp_constr ({ txt = Lident s1 }, []) -> string s1 - | Ptyp_constr (_, cl) -> - separate_map star core_type cl ^^ string (string_of_int (List.length cl)) + | Ptyp_constr ({ txt = Lident s1 }, cl) -> + string s1 ^^ lparen ^^ separate_map star core_type cl ^^ rparen | _ -> string "other type..." and structure structureItems = From 4b2734a5a2e7fe29077512b9f86752ec383171e3 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Thu, 4 May 2023 11:45:12 +0200 Subject: [PATCH 05/13] fix build --- src/reason-parser/reason_pprint_ast_pprint.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index eb37be540..37141208b 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -1,3 +1,4 @@ +[@@@warning "-27-33-32"] open Reason_omp open Ast_411 open Asttypes From 0ac9c814a4dc072f1ec75f6637e1d9a58d30e468 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Thu, 4 May 2023 12:16:47 +0200 Subject: [PATCH 06/13] wip --- src/reason-parser/reason_pprint_ast_pprint.ml | 5 +- .../reason_pprint_ast_pprint.mli | 3 +- test/basicStructures.t/run.t.current | 764 ++++++++++++++++++ test/basicStructures.t/run.t.new | 0 4 files changed, 768 insertions(+), 4 deletions(-) create mode 100644 test/basicStructures.t/run.t.current create mode 100644 test/basicStructures.t/run.t.new diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index 37141208b..7949c2786 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -1,12 +1,13 @@ [@@@warning "-27-33-32"] -open Reason_omp -open Ast_411 + +open Ppxlib open Asttypes open Location open Longident open Parsetree open Reason_syntax_util open Reason_attributes + open PPrint let infix_symbols = diff --git a/src/reason-parser/reason_pprint_ast_pprint.mli b/src/reason-parser/reason_pprint_ast_pprint.mli index 932569e8f..a8365a521 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.mli +++ b/src/reason-parser/reason_pprint_ast_pprint.mli @@ -1,5 +1,4 @@ -open Reason_omp -open Ast_411.Parsetree +open Ppxlib val configure : width:int -> diff --git a/test/basicStructures.t/run.t.current b/test/basicStructures.t/run.t.current new file mode 100644 index 000000000..cb5bdd81b --- /dev/null +++ b/test/basicStructures.t/run.t.current @@ -0,0 +1,764 @@ +/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ + +let run = () => { + TestUtils.printSection("Basic Structures"); +}; + +while (something) { + print_string("You're in a while loop"); + print_newline(); +}; + +for (i in 0 to 5) { + print_int(i); + print_newline(); + for (i in 10 downto 0) { + print_string("Counting in reverse direction"); + print_newline(); + }; +}; + +for (i in 0 to endOfRangeMustBeSimple(expr, soWrap)) { + print_int(i); + print_newline(); + for (i in theSame(isTrue, ofThe, startOfRange) downto 0) { + print_string("Counting in reverse direction"); + print_newline(); + }; +}; + +let x = foo^ ^.bar^; + +let x = foo.bar^; + +let x = foo#bar^; + +let x = foo^.bar^; + +let x = (foo^)#bar^; + +/* Prefix operators: + * ! followed by zero or more appropriate_operator_suffix_chars (see the + * lexer). + * ? or ~ followed by at least one appropriate_operator_suffix_chars. + */ +let x = !(!(!foo)).bar; + +let x = !foo.bar; + +let x = !foo#bar; + +let x = !(!foo).bar; + +let x = !(!foo)#bar; + +let x = !(!foo.bar); + +let x = ?!(!foo.bar); + +let x = ! ?!foo.bar; + +let x = ~!(!foo.bar); + +let x = ! ~!foo.bar; + +let x = ~! ~!foo.bar; + +let x = !!foo.bar; + +let x = !!foo#bar; + +let x = !~foo.bar; + +let x = !~foo#bar; + +let noParensNeeded = !blah.foo.bar; + +let parensNeededAroundFirst = (!blah).foo.bar; + +let parensNeededAroundSecond = (!blah.foo).bar; + +let noParensNeeded = !blah#foo#bar; + +let parensNeededAroundFirst = (!blah)#foo#bar; + +let parensNeededAroundSecond = (!blah#foo)#bar; + +let parensWithSpaceNeededAroundFirst = (!(!blah))#foo#bar; + +let parensWithSpaceNeededAroundSecond = (!(!blah#foo))#bar; + +let parensWithSpaceNeededAroundFirst = (?!(+ blah))#foo#bar; + +let parensWithSpaceNeededAroundSecond = (?!(+ blah#foo))#bar; + +let x = !(!foo.bar); + +let x = !(!foo#bar); + +let x = (-10); + +let x = (-5.0); + +let x = Some(-10); + +let x = Some(-5.0); + +let lazy x = 10; +let lazy (x: int) = 10; +let lazy [] = 10; +let lazy true = 10; +let lazy #x = 10; +let lazy `Variant = 10; +let lazy `variant = 10; +let lazy '0' .. '9' = 10; +let lazy (lazy true) = 10; +let lazy [%extend] = 10; + +/* Test precedence on access sugar */ +let x = arr^[0]; + +let x = arr^[0]; + +let x = str^.[0]; + +let x = str^.[0]; + +let x = arr^[0] = 1; + +let x = arr^[0] = 1; + +/* Comments */ +/*Below is an empty comment*/ +/**/; +/** IF + *============================================================================ + */; + +let (/++) = (+); /* // indicates the start of a comment, not an infix op */ + +let something = + if (self.ext.logSuccess) { + print_string("Did tap"); + print_newline(); + }; + +let logTapSuccess = self => + if (self.ext.logSuccess) { + print_string("Did tap"); + print_newline(); + } else { + (); + }; + +let logTapSuccess = self => + if (self.ext.logSuccess) { + print_string("Did tap"); + print_newline(); + }; + +(!data).field = true; +(!data).field1.field2 = true; +(!data.field1).field2 = true; +(!data).field1.field2 = true; +(!data.field1).field2 = true; + +let loop = (appTime, frameTime) => { + if (hasSetup.contents) { + setupScene(); + renderIntoTop(); + hasSetup.contents = true; + }; + process(appTime, frameTime); +}; + +/* These parens should be kept around the entire last if/then/else */ +if (something) { + if (somethingElse) {()} else {"blah"}; +}; + +/* These parens should be kept around just the last if/then*/ +if (something) { + if (somethingElse) {()} else {"blah"}; +}; + +/* Parens should be generated to wrap the entire final if then else. + * To test that it's being parsed correclty, should print "one". */ +if (true) { + if (true) { + print_string("one"); + } else { + print_string("two"); + }; +}; + +/* Should print two */ +if (true) { + if (false) { + print_string("one"); + } else { + print_string("two"); + }; +}; + +/* Should not print */ +if (false) { + if (true) { + print_string("one"); + } else { + print_string("two"); + }; +}; + +/* Should wrap (if a > b then a else b). + * printer( + */ +let printIfFirstArgGreater = true; +let result = + if (printIfFirstArgGreater) { + (a, b) => + if (a > b) { + print_string("a > b"); + } else { + print_string("b >= a"); + }; + } else if ({ + (a, b) => + if (a > b) { + print_string("b < a"); + } else { + print_string("a <= b"); + }; + }) { + print_string("That could never possibly type check"); + print_newline(); + }; + +let myRecord = { + nestedRecord: { + anotherNestedRecord: (instaComp, displayRect) => + if (Graphics.cgRectIntersectsWithSlop( + defaultCompositeTimerRectSlop, + instaComp.relativeRect, + displayRect, + )) { + IoEligible; + } else { + IoInelibleButTryComposition; + }, + }, +}; + +if (printIfFirstArgGreater) { + (a, b) => + if (a > b) { + print_string("a > b"); + }; +} else { + (a, b) => + if (a > b) { + print_string("b < a"); + }; +}; +/* Should Be Parsed As: Cleary a type error, but at least the parsing makes that clear */ +if (printIfFirstArgGreater) { + (a, b) => + if (a > b) { + print_string("a > b"); + } else { + (a, b) => + if (a > b) { + print_string("b < a"); + }; + }; +}; + +(a, b) => + if (a > b) { + print_string("a > b"); + }; + +/* What you probably wanted was: */ +if (printIfFirstArgGreater) { + (a, b) => + if (a > b) { + print_string("a > b"); + }; +} else { + (a, b) => + if (a > b) { + print_string("b < a"); + }; +}; + +/* Mutative if statement: Not used to evaluate to something. */ +if (10 < 100) { + let msg = "If there was any doubt, 10 is in fact less than 100."; + print_string(msg); +} else { + let msg = "All bets are off."; + print_string(msg); +}; + +if (10 < 100) { + print_string("If there was any doubt, 10 is in fact less than 100."); +} else { + print_string("All bets are off."); +}; + +/** TYPE CONSTRAINTS + *============================================================================ + */; +let x: int = 10; +let x: int = 10; +let x: int = 10; +let x: int = (10: int); +/* let (x:int) = (10:string); */ +/* let (x:string) = ("hello":int); */ + +/** TUPLES + *============================================================================ + */; + +/* In Reason, types look like the data they model! Tuples are no exception. */ +type pairOfInts = (int, int); +let letBindingWithTypeConstraint: int = 10; +let (tupleItem: int, withTypeConstraint: int) = (10, 20); + +/* To make sure that tuple field annotations are annotating the entire field */ +let _dummyFunc = x => 10; +let annotatingFuncApplication = ( + _dummyFunc("a"): int, + _dummyFunc("a"): int, +); + +/* Pretty printer might stick the [int] at the label. */ +let annotatingSingleFuncApplication: int = _dummyFunc("a"); + +/* So lets try a place where it won't */ +let annotatingSingleFuncApplication = { + /* Commenting a let binding. */ + let a = 100; + /* Commenting another let binding. */ + let int = 200; + /* + * This demonstrates why named arguments cannot simply have the form (func + * arg:val) - it is indistinguishable from a type constraint. + */ + 2 + (_dummyFunc(a): int); +}; + +let (tupleItem: int, constrainedWithoutGrouping: int) = (10, 20); +let (tupleItem, withOutsideTypeConstraint): (int, int) = (10, 20); + +/* Trailing commas */ +let trailingCommaAccepted = (1, 2); +let moreTrailing = (1, 2, 3, 4, 5, 7); + +/** Immutable Lists + * ============================================================================ + */; + +/* Anatomy: -Head- --------- Tail--------- nil: You can't see nil */ +let x: list(int) = [1, 2, 3, 4, 5, 6, 7, 8, 9]; +let hd = "appendedToHead"; +let tl = ["listTo", "append", "to"]; + +/* To push *one* and only *one* item to the front of a list - use [hd, ...tl] */ +let result: list(string) = [hd, ...tl]; + +/* Is the same as writing */ +let result: list(string) = ["appendedToHead", "listTo", "append", "to"]; + +/* To operate on lists, use pattern matching */ +let rec size = + fun + | [] => 0 + | [hd, ...tl] => 1 + size(tl); + +/* Optimize for tail recursion */ +let rec size = (soFar, lst) => + switch (lst) { + | [] => 0 + | [hd, ...tl] => size(soFar + 1, tl) + }; + +let nestedMatch = lstLst => + switch (lstLst) { + | [hd, ...tl] when false => 10 + | [hd, ...tl] => + switch (tl) { + | [] => 0 + 0 + | [tlHd, ...tlTl] => 0 + 1 + } + | [] => 0 + }; + +let nestedMatchWithWhen = lstLst => + switch (lstLst) { + | [hd, ...tl] when false => 10 + | [hd, ...tl] when true => + switch (tl) { + | [] when false => 0 + 0 + | [] when true => 0 + 0 + | [tlHd, ...tlTl] => 0 + 1 + } + | [] => 0 + }; + +/** + * Aliasing with "as" during matches. + */; +type mine = + | MyThing(int) + | YourThing(int); +/* + * Reason parses "as" aliases differently than OCaml. + */ +let ppp = + switch (MyThing(20)) { + | MyThing(x) as ppp + | YourThing(x) as ppp => ppp + }; + +let MyThing(_) as ppp | YourThing(_) as ppp = ppp; + +/* + * in order to achieve the previous example in ocaml, you would have to group + * as: + */ +let ppp = + switch (MyThing(20)) { + | MyThing(x) as ppp + | YourThing(x) as ppp => ppp + }; + +let MyThing(_) as ppp | YourThing(_) as ppp = ppp; +/* + * But this isn't needed in Reason because OR patterns have much lower + * precedence - they should be pretty printed in the same way. + */ + +/* TODO: */ +/* let rec nestedMatch lstLst => match lstLst with { */ +/* hd::tl: match tl with { */ +/* []: 0 + 0, */ +/* tlHd::tlTl: 0 + 1, */ +/* }, */ +/* []: 0 */ +/* }; */ +/* */ + +/** ARRAYS + * ============================================================================ + * Arrays are weird looking. Usually you want lists because they support pattern + * matching - that's why they have nicer syntax - to entice you. But if you want + * random access and better control over memory layout, use arrays. + */; +let emptyArray = [||]; +let arrayWithOne = [|10|]; +let arrayWithTwo = [|10, 10|]; +let secondItem = arrayWithTwo[1]; + +/* Getting And Setting: Yeah, we should really change this */ +/* Get an array item at index 1 */ +let secondItem = arrayWithTwo[1]; +/* Set an array item at index 1 */ +arrayWithTwo[1] = 300; + +/** + * STRINGS + * ============================================================================ + * The language supports mutating strings, but that should not be depended upon. + */; +let myString = "asdf"; +myString.[2] = '9'; /* Replacing a character: I could do without this sugar */ + +/* FUNCTIONS + *============================================================================= + */ + +/* TYPE ANNOTATIONS + * ============================================================================= + */ + +let one = 900; +let two = 10000; +/* Tuple expressions can be annotated without additional paren wrapping */ +let myTuple = (one: int, two: int); +type myTupleType = (int, int); +let myTuple: myTupleType = myTuple; + +/* Anything *outside* of a tuple, must still be annotated within parens. */ +let myTuple: myTupleType = (one: int, two: int); + +/* Now functions that accept a single argument being a tuple look familiar */ +let addValues = (a: int, b: int) => { + a + b; +}; + +let addValues = (a: int, b: int) => { + a + b; +}; + +let myFunction = (a: int, b: int): int => a + b; + +let functionReturnValueType = (i: int, s: string): (int => int) => x => x + 1; + +let curriedFormOne = (i: int, s: string) => s ++ string_of_int(i); + +let curriedFormTwo = (i: int, x: int): (int, int) => (i, x); +/* let nonCurriedFormTwo = fun (i:int, x:int) (:(int, int)) => (i, x); */ + +let curriedFormThree = + (i: int, (a: int, b: int): (int, int)): (int, int, int) => ( + i, + a, + b, +); + +/* let nonCurriedFormThree = fun (i:int, (a:int, b:int):(int, int)) (:(int, int, int)) => (i, a, b); */ + +/** TODO: But this, however doesn't work. + * let (myCurriedFunc: int => int) a => a; + * Note: This is likely because only "simple patterns" are accepted as constraints + * in let bindings - that may be easy to change. + */; + +type myFuncType = (int, int) => int; + +let myFunc: myFuncType = (a, b) => a + b; + +let funcWithTypeLocallyAbstractTypes = + (type atype, type btype, a, b, c: (atype, btype) => unit) => + c(a, b); + +/* Checks that function types aren't unnecessary wrapped */ +type a = unit => unit; + +type b = + | Foo(unit => unit) + | Bar(unit => unit, unit => unit, (a, b) => c) + | Baz(unit => unit, unit => unit, (a, b) => c); + +type c = + | Foo((a, b) => unit) + | Bar((a, b) => unit); + +type d = [> | `Foo(unit => unit)]; + +/** + * Records: + *============================================================================= + */; + +type withThreeFields = { + name: string, + age: int, + occupation: string, +}; + +let testRecord = {name: "joe", age: 20, occupation: "engineer"}; +let anotherRecord = {...testRecord, name: "joe++", age: testRecord.age + 10}; + +let makeRecordBase = () => {name: "Joe", age: 30, occupation: "Engineer"}; +let anotherRecord = { + /* These parens should be evaporated. */ + ...makeRecordBase(), + name: "joe++", + age: testRecord.age + 10, +}; + +let anotherRecord = { + /* Comments should be correctly placed before ... expression */ + ...makeRecordBase(), + /* Comment after record extension */ + name: "joe++", + age: testRecord.age + 10, +}; + +let anotherRecord = { + /* Currently, type annotations must be wrapped in parens - that's easy to improve */ + ...(makeRecordBase(): withThreeFields), + name: "joe++", + age: testRecord.age + 10, +}; + +let anotherRecord = { + /* This is meaningless, sure */ + ...someArray.[0] = 20, + name: "joe++", + age: testRecord.age + 10, +}; + +let anotherRecord = { + ... + SomeReally.longFunctionCall({ + passingRecordField: 0, + andThisOtherRecordField: 10, + }), + name: "joe++", + age: testRecord.age + 10, +}; + +let anotherRecord = { + ...SomeReally.longFunctionCall(withArguments, thatWrap: bool), + name: "joe++", + age: testRecord.age + 10, +}; + +let anotherRecord = { + ... + SomeReally.longFunctionCall( + withArg, + ["and", "final", "list", "that", "should", "break"], + ), + name: "joe++", + age: testRecord.age + 10, +}; + +/* Record type punning */ +type props = {title: string}; + +type state = unit; + +type component = {props}; + +type component2 = { + props, + state, + updater: unit, +}; + +type component3 = { + props: M.props, + state, +}; + +type mutableComponent = {mutable props}; + +type mutabeleComponent2 = { + mutable props, + mutable state, + style: int, +}; + +/* Don't pun parameterized types */ +type description('props) = { + element: string, + tag: tag('props), +}; + +/* Don't pun types from other modules */ +module Foo = { + type bar = {foo: Baz.foo}; +}; + +/* Don't pun field names that aren't "simple" */ +type foo = { + bar: Baz.bar, + qux, + fooo: Fooo.fooo, +}; + +let moreFoo = {bar: Baz.bar, qux, fooo: Fooo.fooo}; + +/* record value punning */ + +let props = {title: "hi"}; +/* no punning available for a single field. Can't tell the difference with a scope + expression */ +let componentA = {props: props}; +/* pun for real */ +let componentB = {props, state: ()}; +/* pun fields with module prefix too */ +let foo = {Foo.foo: foo}; +let bar = {Foo.foo, bar: 1}; +let bar = {bar: 1, Foo.foo}; +let bar = {Foo.foo, Bar.bar}; + +({M.x, y}) => 1; + +switch (foo) { +| {y: 1, M.x} => 2 +}; + +/* Requested in #566 */ +let break_after_equal = no_break_from_here(some_call(to_here)); + +/* Pexp_letexception */ +let () = { + exception E; + raise(E); +}; + +/* # 1587: don't print fun keyword when printing Pexp_fun in a record expression */ +{contents: () => ((): unit)}; + +/* #1556: Always break nested record/obj */ +let z = { + a: { + b: c, + d: e, + }, + f: g, +}; + +let z = { + a: { + "b": c, + "d": e, + }, + f: g, +}; + +let z = { + a: { + pub b = c; + pub d = e + }, + f: g, +}; + +let z = { + "a": { + "b": c, + "d": e, + }, + "f": g, +}; + +let z = { + "a": { + b: c, + d: e, + }, + "f": g, +}; + +let z = { + "a": { + pub b = c; + pub d = e + }, + "f": g, +}; + +/** + * Unnecessary parens should be removed. + */ +let unitLambda = () => (); +let identifierLambda = a => (); +let underscoreLambda = _ => (); +it("should remove parens", a => { + print_string("did it work?"); + print_string("did it work?"); +}); + +/* https://github.com/facebook/reason/issues/1554 */ +(curNode^)##childNodes; + +foo(preserveBraces => {inCallback}); + +foo(preserveBraces => {inFirstPos}, secondArg); + +foo(oneArg, preserveBraces => {inFirstPos}, secondArg); diff --git a/test/basicStructures.t/run.t.new b/test/basicStructures.t/run.t.new new file mode 100644 index 000000000..e69de29bb From 2330afdcd9f9e72e3260e5ee65c2273bfebab7b5 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Thu, 4 May 2023 12:21:37 +0200 Subject: [PATCH 07/13] fix build --- src/reason-parser/reason_pprint_ast_pprint.ml | 6 +- test/basicStructures.t/run.t.new | 569 ++++++++++++++++++ 2 files changed, 572 insertions(+), 3 deletions(-) diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index 7949c2786..c8983bb83 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -7,7 +7,6 @@ open Longident open Parsetree open Reason_syntax_util open Reason_attributes - open PPrint let infix_symbols = @@ -402,7 +401,7 @@ and pattern ?(wrap = true) ppat_desc = Ppat_construct ( { txt = Lident "::" }, - Some { ppat_desc = Ppat_tuple [ pat1; pat2 ] } ); + Some ([], { ppat_desc = Ppat_tuple [ pat1; pat2 ] }) ); } -> list_items_cons (pat1 :: acc) pat2 | p -> (List.rev acc, p) @@ -426,7 +425,8 @@ and pattern ?(wrap = true) ^^ rbracket) | Ppat_construct ({ txt = Lident "()" }, None) -> if wrap then empty else string "()" - | Ppat_construct ({ txt = Lident s }, c) -> string s ^^ optional pattern c + | Ppat_construct ({ txt = Lident s }, c) -> + string s ^^ optional (fun f -> pattern (snd f)) c | Ppat_construct (s, s2) -> string "todo Ppatconstruct" | Ppat_variant (l, po) -> string "todo: Ppat_variant" | Ppat_record (pl, c) -> diff --git a/test/basicStructures.t/run.t.new b/test/basicStructures.t/run.t.new index e69de29bb..f1a30d458 100644 --- a/test/basicStructures.t/run.t.new +++ b/test/basicStructures.t/run.t.new @@ -0,0 +1,569 @@ +let run = => todo pexident("Basic Structures"); + +todo Pexp_while; + +todo Pexp_for; + +todo Pexp_for; + +let x = !(todo Pexp_field); + +let x = !(todo Pexp_field); + +let x = !(todo Pexp_send); + +let x = !(todo Pexp_field); + +let x = !(todo Pexp_send); + +let x = not(todo Pexp_field); + +let x = not(todo Pexp_field); + +let x = not(todo Pexp_send); + +let x = not(todo Pexp_field); + +let x = not(todo Pexp_send); + +let x = not(not(todo Pexp_field)); + +let x = ?!(not(todo Pexp_field)); + +let x = not(?!(todo Pexp_field)); + +let x = ~!(not(todo Pexp_field)); + +let x = not(~!(todo Pexp_field)); + +let x = ~!(~!(todo Pexp_field)); + +let x = !!(todo Pexp_field); + +let x = !!(todo Pexp_send); + +let x = !~(todo Pexp_field); + +let x = !~(todo Pexp_send); + +let noParensNeeded = not(todo Pexp_field); + +let parensNeededAroundFirst = todo Pexp_field; + +let parensNeededAroundSecond = todo Pexp_field; + +let noParensNeeded = not(todo Pexp_send); + +let parensNeededAroundFirst = todo Pexp_send; + +let parensNeededAroundSecond = todo Pexp_send; + +let parensWithSpaceNeededAroundFirst = todo Pexp_send; + +let parensWithSpaceNeededAroundSecond = todo Pexp_send; + +let parensWithSpaceNeededAroundFirst = todo Pexp_send; + +let parensWithSpaceNeededAroundSecond = todo Pexp_send; + +let x = not(not(todo Pexp_field)); + +let x = not(not(todo Pexp_send)); + +let x = -10; + +let x = -5.; + +let x = Some(-10); + +let x = Some(-5.); + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let todo: Ppat_lazy = 10; + +let x = todo pexident(!(arr), 0); + +let x = todo pexident(!(arr), 0); + +let x = todo pexident(!(str), 0); + +let x = todo pexident(!(str), 0); + +let x = todo pexident(!(arr), 0, 1); + +let x = todo pexident(!(arr), 0, 1); + +todo Pstr_attribute + +todo Pstr_attribute + +let /++ = +; + +let something = todo Pexp_ifthenelse; + +let logTapSuccess = self => todo Pexp_ifthenelse; + +let logTapSuccess = self => todo Pexp_ifthenelse; + +todo Pexp_setfield; + +todo Pexp_setfield; + +todo Pexp_setfield; + +todo Pexp_setfield; + +todo Pexp_setfield; + +let loop = (appTime, frameTime) => todo Pexp_sequence; + +todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +let printIfFirstArgGreater = true; + +let result = todo Pexp_ifthenelse; + +let myRecord = { + nestedRecord: { + anotherNestedRecord: (instaComp, displayRect) => todo Pexp_ifthenelse, + }, +}; + +todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +(a, b) => todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +todo Pexp_ifthenelse; + +todo Pstr_attribute + +let x = (10: int); + +let x = (10: int); + +let (x: int) = 10; + +let (x: int) = (10: int); + +todo Pstr_attribute + +type pairOfInts = other type...; + +let (letBindingWithTypeConstraint: int) = 10; + +let ((tupleItem: int), (withTypeConstraint: int)) = ( + 10, + 20, +); + +let _dummyFunc = x => 10; + +let annotatingFuncApplication = ( + (_dummyFunc("a"): int), + (_dummyFunc("a"): int), +); + +let annotatingSingleFuncApplication = ( +_dummyFunc( + "a", +): int); + +let annotatingSingleFuncApplication = +let a = 100; + +let int = 200; +2 + (_dummyFunc(a): int);;; + +let ( + (tupleItem: int), + (constrainedWithoutGrouping: int), +) = (10, 20); + +let ((tupleItem, withOutsideTypeConstraint): other type...) = ( + 10, + 20, +); + +let trailingCommaAccepted = (1, 2); + +let moreTrailing = (1, 2, 3, 4, 5, 7); + +todo Pstr_attribute + +let x = (::( + 1, + ::( + 2, + ::( + 3, + ::(4, ::(5, ::(6, ::(7, ::(8, ::(9, [])))))), + ), + ), +): list(int)); + +let hd = "appendedToHead"; + +let tl = ::("listTo", ::("append", ::("to", []))); + +let result = (::(hd, tl): list(string)); + +let result = (::( + "appendedToHead", + ::("listTo", ::("append", ::("to", []))), +): list(string)); + +let recsize = ( + fun + | [] => 0 + | [hd, ...tl] => 1 + size(tl) +); + +let recsize = (soFar, lst) => +switch (lst) { +| [] => 0 +| [hd, ...tl] => size(soFar + 1, tl) +}; + +let nestedMatch = lstLst => +switch (lstLst) { +| [hd, ...tl] when false => 10 +| [hd, ...tl] => + switch (tl) { + | [] => 0 + 0 + | [tlHd, ...tlTl] => 0 + 1 + } +| [] => 0 +}; + +let nestedMatchWithWhen = lstLst => +switch (lstLst) { +| [hd, ...tl] when false => 10 +| [hd, ...tl] when true => + switch (tl) { + | [] when false => 0 + 0 + | [] when true => 0 + 0 + | [tlHd, ...tlTl] => 0 + 1 + } +| [] => 0 +}; + +todo Pstr_attribute + +type mine = + | MyThing(int) + | YourThing(int); + +let ppp = + switch (MyThing(20)) { + | todo: Ppat_alias + | todo: Ppat_alias => ppp + }; + +let todo: Ppat_alias +| todo: Ppat_alias = ppp; + +let ppp = + switch (MyThing(20)) { + | todo: Ppat_alias + | todo: Ppat_alias => ppp + }; + +let todo: Ppat_alias +| todo: Ppat_alias = ppp; + +todo Pstr_attribute + +let emptyArray = todo Pexp_array; + +let arrayWithOne = todo Pexp_array; + +let arrayWithTwo = todo Pexp_array; + +let secondItem = todo pexident(arrayWithTwo, 1); + +let secondItem = todo pexident(arrayWithTwo, 1); + +todo pexident(arrayWithTwo, 1, 300); + +todo Pstr_attribute + +let myString = "asdf"; + +todo pexident(myString, 2, '9'); + +let one = 900; + +let two = 10000; + +let myTuple = ((one: int), (two: int)); + +type myTupleType = other type...; + +let myTuple = (myTuple: myTupleType); + +let myTuple = (( + (one: int), + (two: int), +): myTupleType); + +let addValues = ((a: int), (b: int)) => a + b; + +let addValues = ((a: int), (b: int)) => a + b; + +let myFunction = ((a: int), (b: int)) => (a + b: int); + +let functionReturnValueType = ((i: int), (s: string)) => (x => x + 1: other type...); + +let curriedFormOne = ((i: int), (s: string)) => s ^ +string_of_int( + i, +); + +let curriedFormTwo = ((i: int), (x: int)) => (( + i, + x, +): other type...); + +let curriedFormThree = ((i: int), (( + (a: int), + (b: int), +): other type...)) => (( + i, + a, + b, +): other type...); + +todo Pstr_attribute + +type myFuncType = other type...; + +let myFunc = ((a, b) => a + b: myFuncType); + +let funcWithTypeLocallyAbstractTypes = todo Pexp_newtype; + +type a = other type...; + +type b = + | Foo(other type...) + | Bar(other type..., other type..., other type...) + | Baz(other type..., other type..., other type...); + +type c = + | Foo(other type...) + | Bar(other type...); + +type d = other type...; + +todo Pstr_attribute + +type withThreeFields = { + name: string, + age: int, + occupation: string, +}; + +let testRecord = { + name: "joe", + age: 20, + occupation: "engineer", +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +let makeRecordBase = => { + name: "Joe", + age: 30, + occupation: "Engineer", +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +let anotherRecord = { + name: "joe++", + age: todo Pexp_field + 10, +}; + +type props = { + title: string, +}; + +type state = unit; + +type component = { + props: props, +}; + +type component2 = { + props: props, + state: state, + updater: unit, +}; + +type component3 = { + props: other type..., + state: state, +}; + +type mutableComponent = { + props: props, +}; + +type mutabeleComponent2 = { + props: props, + state: state, + style: int, +}; + +type description = { + element: string, + tag: tag(todo a), +}; + +todo Pstr_module + +type foo = { + bar: other type..., + qux: qux, + fooo: other type..., +}; + +let moreFoo = { + bar: todo pexident, + qux, + fooo: todo pexident, +}; + +let props = {title: "hi"}; + +let componentA = {props}; + +let componentB = {props, state: }; + +let foo = {Ppat_record: not supported}; + +let bar = {Ppat_record: not supported, bar: 1}; + +let bar = {bar: 1, Ppat_record: not supported}; + +let bar = { + Ppat_record: not supported, + Ppat_record: not supported, +}; + +{Ppat_record: not supported, y} => 1; + + +switch (foo) { +| {y: 1, Ppat_record: not supported} => 2 +}; + +let break_after_equal = +no_break_from_here( + some_call(to_here), +); + +let = todo Pexp_letexception; + +{contents: => (: unit)}; + +let z = {a: {b: c, d: e}, f: g}; + +let z = {a: todo Pexp_extension, f: g}; + +let z = {a: todo Pexp_object, f: g}; + +let z = todo Pexp_extension; + +let z = todo Pexp_extension; + +let z = todo Pexp_extension; + +/** + * Unnecessary parens should be removed. + */ +let unitLambda = => ; + +let identifierLambda = a => ; + +let underscoreLambda = _ => ; + + +it( + "should remove parens", + a => todo Pexp_sequence, +); + +!(curNode) ## childNodes; + +foo(preserveBraces => inCallback); + +foo(preserveBraces => inFirstPos, secondArg); + + +foo( + oneArg, + preserveBraces => inFirstPos, + secondArg, +); From b459dbbd9f2b5615d69215a9f6050674692ac07d Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Fri, 5 May 2023 10:40:19 +0200 Subject: [PATCH 08/13] wip: pprint --- src/reason-parser/reason_pprint_ast_pprint.ml | 847 ++- test/basicStructures.t/run.t.ast | 6635 +++++++++++++++++ test/basicStructures.t/run.t.new | 175 +- test/patternMatching.t/run.t.new | 326 + test/sequences.t/run.t.new | 69 + 5 files changed, 7938 insertions(+), 114 deletions(-) create mode 100644 test/basicStructures.t/run.t.ast create mode 100644 test/patternMatching.t/run.t.new create mode 100644 test/sequences.t/run.t.new diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index c8983bb83..6627f67dc 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -1,13 +1,413 @@ -[@@@warning "-27-33-32"] +[@@@warning "-27-32-51-37-34"] -open Ppxlib +open Reason_omp +open Ast_411 open Asttypes open Location open Longident open Parsetree +open PPrint open Reason_syntax_util open Reason_attributes -open PPrint +module Comment = Reason_comment +module Layout = Reason_layout +module WhitespaceRegion = Layout.WhitespaceRegion +module Range = Reason_location.Range + +let source_map = Layout.source_map + +exception NotPossible of string + +let commaTrail = + Layout.SepFinal (",", Reason_syntax_util.TrailingCommaMarker.string) + +let commaSep = Layout.Sep "," + +type ruleInfoData = { + reducePrecedence : precedence; + shiftPrecedence : precedence; +} + +and ruleCategory = + (* Printing will be parsed with very high precedence, so not much need to + worry about ensuring it will reduce correctly. In short, you can put + `FunctionApplication` content anywhere around an infix identifier without + wrapping in parens. For example `myFunc x y z` or `if x {y} else {z}` + The layout is kept in list form only to allow for elegant wrapping rules + to take into consideration the *number* of high precedence parsed items. *) + | FunctionApplication of Layout.t list + (* Care should be taken to ensure the rule that caused it to be parsed will + reduce again on the printed output - context should carefully consider + wrapping in parens according to the ruleInfoData. *) + | SpecificInfixPrecedence of ruleInfoData * resolvedRule + (* Not safe to include anywhere between infix operators without wrapping in + parens. This describes expressions like `fun x => x` which doesn't fit into + our simplistic algorithm for printing function applications separated by infix. + + It might be possible to include these in between infix, but there are + tricky rules to determining when these must be guarded by parens (it + depends highly on context that is hard to reason about). It's so nuanced + that it's easier just to always wrap them in parens. *) + | PotentiallyLowPrecedence of Layout.t + (* Simple means it is clearly one token (such as (anything) or [anything] or identifier *) + | Simple of Layout.t + +(* Represents a ruleCategory where the precedence has been resolved. + * The precedence of a ruleCategory gets resolved in `ensureExpression` or + * `ensureContainingRule`. The result is either a plain Layout.t (where + * parens probably have been applied) or an InfixTree containing the operator and + * a left & right resolvedRule. The latter indicates that the precedence has been resolved, + * but the actual formatting is deferred to a later stadium. + * Think `let x = foo |> f |> z |>`, which requires a certain formatting style when + * things break over multiple lines. *) +and resolvedRule = + | LayoutNode of Layout.t + | InfixTree of string * resolvedRule * resolvedRule + +and associativity = Right | Nonassoc | Left +and precedenceEntryType = TokenPrecedence | CustomPrecedence +and precedence = Token of string | Custom of string + +(* Describes the "fixity" of a token, and stores its *printed* representation + should it be rendered as infix/prefix (This rendering may be different than + how it is stored in the AST). *) +and tokenFixity = + (* Such as !simple_expr and ~!simple_expr. These function applications are + considered *almost* "simple" because they may be allowed anywhere a simple + expression is accepted, except for when on the left hand side of a + dot/send. *) + | AlmostSimplePrefix of string + | UnaryPlusPrefix of string + | UnaryMinusPrefix of string + | UnaryNotPrefix of string + | UnaryPostfix of string + | Infix of string + | Letop of string + | Andop of string + | Normal + +(* Type which represents a resolvedRule's InfixTree flattened *) +type infixChain = InfixToken of string | Layout of Layout.t + +(* Helpers for dealing with extension nodes (%expr) *) + +let expression_extension_sugar x = + if x.pexp_attributes != [] then None + else + match x.pexp_desc with + | Pexp_extension (name, PStr [ { pstr_desc = Pstr_eval (expr, []) } ]) + when name.txt <> "bs.obj" -> + Some (name, expr) + | _ -> None + +let expression_immediate_extension_sugar x = + match expression_extension_sugar x with + | None -> (None, x) + | Some (name, expr) -> ( + match expr.pexp_desc with + | Pexp_for _ | Pexp_while _ | Pexp_ifthenelse _ | Pexp_function _ + | Pexp_newtype _ | Pexp_try _ | Pexp_match _ -> + (Some name, expr) + | _ -> (None, x)) + +let expression_not_immediate_extension_sugar x = + match expression_immediate_extension_sugar x with + | Some _, _ -> None + | None, _ -> expression_extension_sugar x + +let add_extension_sugar keyword = function + | None -> keyword + | Some str -> keyword ^ "%" ^ str.txt + +let string_equal : string -> string -> bool = ( = ) + +let string_loc_equal : + string Ast_411.Asttypes.loc -> string Ast_411.Asttypes.loc -> bool = + fun l1 l2 -> l1.txt = l2.txt + +let longident_same l1 l2 = + let rec equal l1 l2 = + match (l1, l2) with + | Lident l1, Lident l2 -> string_equal l1 l2 + | Ldot (path1, l1), Ldot (path2, l2) -> + equal path1 path2 && string_equal l1 l2 + | Lapply (l11, l12), Lapply (l21, l22) -> equal l11 l21 && equal l12 l22 + | _ -> false + in + equal l1.txt l2.txt + +(* A variant of List.for_all2 that returns false instead of failing on lists + of different size *) +let for_all2' pred l1 l2 = + List.length l1 = List.length l2 && List.for_all2 pred l1 l2 + +(* + Checks to see if two types are the same modulo the process of varification + which turns abstract types into type variables of the same name. + For example, [same_ast_modulo_varification] would consider (a => b) and ('a + => 'b) to have the same ast. This is useful in recovering syntactic sugar + for explicit polymorphic types with locally abstract types. + + Does not compare attributes, or extensions intentionally. + + TODO: This has one more issue: We need to compare only accepting t1's type + variables, to be considered compatible with t2's type constructors - not the + other way around. + *) +let same_ast_modulo_varification_and_extensions t1 t2 = + let rec loop t1 t2 = + match (t1.ptyp_desc, t2.ptyp_desc) with + (* Importantly, cover the case where type constructors (of the form [a]) + are converted to type vars of the form ['a]. + *) + | Ptyp_constr ({ txt = Lident s1 }, []), Ptyp_var s2 -> string_equal s1 s2 + (* Now cover the case where type variables (of the form ['a]) are + converted to type constructors of the form [a]. + *) + | Ptyp_var s1, Ptyp_constr ({ txt = Lident s2 }, []) -> string_equal s1 s2 + (* Now cover the typical case *) + | Ptyp_constr (longident1, lst1), Ptyp_constr (longident2, lst2) -> + longident_same longident1 longident2 && for_all2' loop lst1 lst2 + | Ptyp_any, Ptyp_any -> true + | Ptyp_var x1, Ptyp_var x2 -> string_equal x1 x2 + | ( Ptyp_arrow (label1, core_type1, core_type1'), + Ptyp_arrow (label2, core_type2, core_type2') ) -> + (match (label1, label2) with + | Nolabel, Nolabel -> true + | Labelled s1, Labelled s2 -> string_equal s1 s2 + | Optional s1, Optional s2 -> string_equal s1 s2 + | _ -> false) + && loop core_type1 core_type2 + && loop core_type1' core_type2' + | Ptyp_tuple lst1, Ptyp_tuple lst2 -> for_all2' loop lst1 lst2 + | Ptyp_object (lst1, o1), Ptyp_object (lst2, o2) -> + let tester t1 t2 = + match (t1.pof_desc, t2.pof_desc) with + | Otag (s1, t1), Otag (s2, t2) -> + string_equal s1.txt s2.txt && loop t1 t2 + | Oinherit t1, Oinherit t2 -> loop t1 t2 + | _ -> false + in + for_all2' tester lst1 lst2 && o1 = o2 + | Ptyp_class (longident1, lst1), Ptyp_class (longident2, lst2) -> + longident_same longident1 longident2 && for_all2' loop lst1 lst2 + | Ptyp_alias (core_type1, string1), Ptyp_alias (core_type2, string2) -> + loop core_type1 core_type2 && string_equal string1 string2 + | ( Ptyp_variant (row_field_list1, flag1, lbl_lst_option1), + Ptyp_variant (row_field_list2, flag2, lbl_lst_option2) ) -> + for_all2' rowFieldEqual row_field_list1 row_field_list2 + && flag1 = flag2 + && lbl_lst_option1 = lbl_lst_option2 + | Ptyp_poly (string_lst1, core_type1), Ptyp_poly (string_lst2, core_type2) + -> + for_all2' string_loc_equal string_lst1 string_lst2 + && loop core_type1 core_type2 + | Ptyp_package (longident1, lst1), Ptyp_package (longident2, lst2) -> + longident_same longident1 longident2 + && for_all2' testPackageType lst1 lst2 + | Ptyp_extension (s1, _), Ptyp_extension (s2, _) -> + string_equal s1.txt s2.txt + | _ -> false + and testPackageType (lblLongIdent1, ct1) (lblLongIdent2, ct2) = + longident_same lblLongIdent1 lblLongIdent2 && loop ct1 ct2 + and rowFieldEqual f1 f2 = + match (f1.prf_desc, f2.prf_desc) with + | Rtag (label1, flag1, lst1), Rtag (label2, flag2, lst2) -> + string_equal label1.txt label2.txt + && flag1 = flag2 && for_all2' loop lst1 lst2 + | Rinherit t1, Rinherit t2 -> loop t1 t2 + | _ -> false + in + loop t1 t2 + +let expandLocation pos ~expand:(startPos, endPos) = + { + pos with + loc_start = + { + pos.loc_start with + Lexing.pos_cnum = pos.loc_start.Lexing.pos_cnum + startPos; + }; + loc_end = + { + pos.loc_end with + Lexing.pos_cnum = pos.loc_end.Lexing.pos_cnum + endPos; + }; + } + +(* Computes the location of the attribute with the lowest line number + * that isn't ghost. Useful to determine the start location of an item + * in the parsetree that has attributes. + * If there are no valid attributes, defaults to the passed location. + * 1| [@attr] --> notice how the "start" is determined + * 2| let f = ... by the attr on line 1, not the lnum of the `let` + *) +let rec firstAttrLoc loc = function + | ({ attr_name = attrLoc; _ } : Parsetree.attribute) :: attrs -> + if + attrLoc.loc.loc_start.pos_lnum < loc.loc_start.pos_lnum + && not attrLoc.loc.loc_ghost + then firstAttrLoc attrLoc.loc attrs + else firstAttrLoc loc attrs + | [] -> loc + +let extractLocationFromValBindList expr vbs = + let rec extract loc = function + | x :: xs -> + let { pvb_expr } = x in + let loc = { loc with loc_end = pvb_expr.pexp_loc.loc_end } in + extract loc xs + | [] -> loc + in + let loc = + match vbs with + | x :: xs -> + let { pvb_pat; pvb_expr } = x in + let loc = + { pvb_pat.ppat_loc with loc_end = pvb_expr.pexp_loc.loc_end } + in + extract loc xs + | [] -> expr.pexp_loc + in + { loc with loc_start = expr.pexp_loc.loc_start } + +let extractLocValBinding { pvb_pat; pvb_expr; pvb_attributes } = + let estimatedLoc = firstAttrLoc pvb_pat.ppat_loc pvb_attributes in + { estimatedLoc with loc_end = pvb_expr.pexp_loc.loc_end } + +let extractLocBindingOp { pbop_pat; pbop_exp } = + let estimatedLoc = firstAttrLoc pbop_pat.ppat_loc [] in + { estimatedLoc with loc_end = pbop_exp.pexp_loc.loc_end } + +let extractLocModuleBinding { pmb_expr; pmb_attributes } = + let estimatedLoc = firstAttrLoc pmb_expr.pmod_loc pmb_attributes in + { estimatedLoc with loc_end = pmb_expr.pmod_loc.loc_end } + +let extractLocModDecl { pmd_type; pmd_attributes } = + let estimatedLoc = firstAttrLoc pmd_type.pmty_loc pmd_attributes in + { estimatedLoc with loc_end = pmd_type.pmty_loc.loc_end } + +let rec sequentialIfBlocks x = + match x with + | Some { pexp_desc = Pexp_ifthenelse (e1, e2, els) } -> + let nestedIfs, finalExpression = sequentialIfBlocks els in + ((e1, e2) :: nestedIfs, finalExpression) + | Some e -> ([], Some e) + | None -> ([], None) + +(* + TODO: IDE integration beginning with Vim: + + - Create recovering version of parser that creates regions of "unknown" + content in between let sequence bindings (anything between semicolons, + really). + - Use Easy_format's "style" features to tag each known node. + - Turn those style annotations into editor highlight commands. + - Editors have a set of keys that retrigger the parsing/rehighlighting + process (typically newline/semi/close-brace). + - On every parsing/rehighlighting, this pretty printer can be used to + determine the highlighting of recovered regions, and the editor plugin can + relegate highlighting of malformed regions to the editor which mostly does + so based on token patterns. + +*) + +(* + @avoidSingleTokenWrapping + + +-----------------------------+ + |+------+ | Another label + || let ( \ | + || a | Label | + || o | | The thing to the right of any label must be a + || p _+ label RHS | list in order for it to wrap correctly. Lists + || ): / v | will wrap if they need to/can. NON-lists will + |+--+ sixteenTuple = echoTuple|( wrap (indented) even though they're no lists! + +---/ 0,\---------------------+ To prevent a single item from wrapping, make + 0, an unbreakable list via ensureSingleTokenSticksToLabel. + 0 + ); In general, the best approach for indenting + let bindings is to keep building up labels from + the "let", always ensuring things that you want + to wrap will either be lists or guarded in + [ensureSingleTokenSticksToLabel]. + If you must join several lists together (via =) + (or colon), ensure that joining is done via + [makeList] (which won't break), and that new + list is always appended to the left + hand side of the label. (So that the right hand + side may always be the untouched list that you want + to wrap with aligned closing). + Always make sure rhs of the label are the + + Creating nested labels will preserve the original + indent location ("let" in this + case) as long as that nesting is + done on the left hand side of the labels. + +*) + +(* + Table 2.1. Precedence and associativity. + Precedence from highest to lowest: From RWOC, modified to include != + --------------------------------------- + + Operator prefix Associativity + !..., ?..., ~... Prefix + ., .(, .[ - + function application, constructor, assert, lazy Left associative + -, -. Prefix + **..., lsl, lsr, asr Right associative + *..., /..., %..., mod, land, lor, lxor Left associative + +..., -... Left associative + :: Right associative + @..., ^... Right associative +--- + != Left associative (INFIXOP0 listed first in lexer) + =..., <..., >..., |..., &..., $... Left associative (INFIXOP0) + =, <, > Left associative (IN SAME row as INFIXOP0 listed after) +--- + &, && Right associative + or, || Right associative + , - + :=, = Right associative + if - + ; Right associative + + + Note: It would be much better if &... and |... were in separate precedence + groups just as & and | are. This way, we could encourage custom infix + operators to use one of the two precedences and no one would be confused as + to precedence (leading &, | are intuitive). Two precedence classes for the + majority of infix operators is totally sufficient. + + TODO: Free up the (&) operator from pervasives so it can be reused for + something very common such as string concatenation or list appending. + + let x = tail & head; + *) + +(* "Almost Simple Prefix" function applications parse with the rule: + + `PREFIXOP simple_expr %prec below_DOT_AND_SHARP`, which in turn is almost + considered a "simple expression" (it's acceptable anywhere a simple + expression is except in a couple of edge cases. + + "Unary Prefix" function applications parse with the rule: + + `MINUS epxr %prec prec_unary_minus`, which in turn is considered an + "expression" (not simple). All unary operators are mapped into an identifier + beginning with "~". + + TODO: Migrate all "almost simple prefix" to "unsary prefix". When `!` + becomes "not", then it will make more sense that !myFunc (arg) is parsed as + !(myFunc arg) instead of (!myFunc) arg. +*) +let almost_simple_prefix_symbols = [ '!'; '?'; '~' ] + +(* Subset of prefix symbols that have special "unary precedence" *) +let unary_minus_prefix_symbols = [ "~-"; "~-." ] +let unary_plus_prefix_symbols = [ "~+"; "~+." ] let infix_symbols = [ '='; '<'; '>'; '@'; '^'; '|'; '&'; '+'; '-'; '*'; '/'; '$'; '%'; '\\'; '#' ] @@ -16,7 +416,324 @@ let infix_symbols = let special_infix_strings = [ "asr"; "land"; "lor"; "lsl"; "lsr"; "lxor"; "mod"; "or"; ":="; "!="; "!==" ] -let isInfix i = List.mem i.[0] infix_symbols || List.mem i special_infix_strings +(* REMOVE *) +let updateToken = "=" +let sharpOpEqualToken = "#=" +let pipeFirstToken = "->" +let requireIndentFor = [ updateToken; ":=" ] +let namedArgSym = "~" + +let requireNoSpaceFor tok = + tok = pipeFirstToken || (tok.[0] = '#' && tok <> "#=") + +let funToken = "fun" + +let getPrintableUnaryIdent s = + if + List.mem s unary_minus_prefix_symbols + || List.mem s unary_plus_prefix_symbols + then String.sub s 1 (String.length s - 1) + else s + +(* determines if the string is an infix string. + checks backwards, first allowing a renaming postfix ("_102") which + may have resulted from Pexp -> Texp -> Pexp translation, then checking + if all the characters in the beginning of the string are valid infix + characters. *) +let printedStringAndFixity = function + | s when List.mem s special_infix_strings -> Infix s + | "^" -> UnaryPostfix "^" + | s when List.mem s.[0] infix_symbols -> Infix s + (* Correctness under assumption that unary operators are stored in AST with + leading "~" *) + | s + when List.mem s.[0] almost_simple_prefix_symbols + && (not (List.mem s special_infix_strings)) + && not (s = "?") -> + if (* What *kind* of prefix fixity? *) + List.mem s unary_plus_prefix_symbols + then UnaryPlusPrefix (getPrintableUnaryIdent s) + else if List.mem s unary_minus_prefix_symbols then + UnaryMinusPrefix (getPrintableUnaryIdent s) + else if s = "!" then UnaryNotPrefix s + else AlmostSimplePrefix s + | s when is_letop s -> Letop s + | s when is_andop s -> Andop s + | _ -> Normal + +(* Also, this doesn't account for != and !== being infixop!!! *) +let isSimplePrefixToken s = + match printedStringAndFixity s with + | AlmostSimplePrefix _ | UnaryPostfix "^" -> true + | _ -> false + +(* Convenient bank of information that represents the parser's precedence + rankings. Each instance describes a precedence table entry. The function + tests either a token string encountered by the parser, or (in the case of + `CustomPrecedence`) the string name of a custom rule precedence declared + using %prec *) +let rules = + [ + [ + (TokenPrecedence, fun s -> (Left, s = pipeFirstToken)); + ( TokenPrecedence, + fun s -> (Left, s.[0] = '#' && s <> sharpOpEqualToken && s <> "#") ); + (TokenPrecedence, fun s -> (Left, s = ".")); + (CustomPrecedence, fun s -> (Left, s = "prec_lbracket")); + ]; + [ (CustomPrecedence, fun s -> (Nonassoc, s = "prec_functionAppl")) ]; + [ (TokenPrecedence, fun s -> (Right, isSimplePrefixToken s)) ]; + [ (TokenPrecedence, fun s -> (Left, s = sharpOpEqualToken)) ]; + [ (CustomPrecedence, fun s -> (Nonassoc, s = "prec_unary")) ]; + (* Note the special case for "*\*", BARBAR, and LESSMINUS, AMPERSAND(s) *) + [ + (TokenPrecedence, fun s -> (Right, s = "**")); + ( TokenPrecedence, + fun s -> + ( Right, + String.length s > 1 && s.[0] == '*' && s.[1] == '\\' && s.[2] == '*' + ) ); + (TokenPrecedence, fun s -> (Right, s = "lsl")); + (TokenPrecedence, fun s -> (Right, s = "lsr")); + (TokenPrecedence, fun s -> (Right, s = "asr")); + ]; + [ + ( TokenPrecedence, + fun s -> (Left, s.[0] == '*' && (String.length s == 1 || s != "*\\*")) + ); + (TokenPrecedence, fun s -> (Left, s.[0] == '/')); + (TokenPrecedence, fun s -> (Left, s.[0] == '%')); + (TokenPrecedence, fun s -> (Left, s = "mod")); + (TokenPrecedence, fun s -> (Left, s = "land")); + (TokenPrecedence, fun s -> (Left, s = "lor")); + (TokenPrecedence, fun s -> (Left, s = "lxor")); + ]; + [ + (* Even though these use the same *tokens* as unary plus/minus at parse + time, when unparsing infix -/+, the CustomPrecedence rule would be + incorrect to use, and instead we need a rule that models what infix + parsing would use - just the regular token precedence without a custom + precedence. *) + ( TokenPrecedence, + fun s -> + ( Left, + if String.length s > 1 && s.[0] == '+' && s.[1] == '+' then + (* + Explicitly call this out as false because the other ++ case below + should have higher *lexing* priority. ++operator_chars* is considered an + entirely different token than +(non_plus_operator_chars)* + *) + false + else s.[0] == '+' ) ); + (TokenPrecedence, fun s -> (Left, s.[0] == '-' && s <> pipeFirstToken)); + (TokenPrecedence, fun s -> (Left, s = "!")); + ]; + [ (TokenPrecedence, fun s -> (Right, s = "::")) ]; + [ + (TokenPrecedence, fun s -> (Right, s.[0] == '@')); + (TokenPrecedence, fun s -> (Right, s.[0] == '^')); + ( TokenPrecedence, + fun s -> (Right, String.length s > 1 && s.[0] == '+' && s.[1] == '+') ); + ]; + [ + ( TokenPrecedence, + fun s -> (Left, s.[0] == '=' && (not (s = "=")) && not (s = "=>")) ); + (TokenPrecedence, fun s -> (Left, s.[0] == '<' && not (s = "<"))); + (TokenPrecedence, fun s -> (Left, s.[0] == '>' && not (s = ">"))); + (TokenPrecedence, fun s -> (Left, s = "!=")); + (* Not preset in the RWO table! *) + (TokenPrecedence, fun s -> (Left, s = "!==")); + (* Not preset in the RWO table! *) + (TokenPrecedence, fun s -> (Left, s = "==")); + (TokenPrecedence, fun s -> (Left, s = "===")); + (TokenPrecedence, fun s -> (Left, s = "<")); + (TokenPrecedence, fun s -> (Left, s = ">")); + (TokenPrecedence, fun s -> (Left, s.[0] == '|' && not (s = "||"))); + ( TokenPrecedence, + fun s -> (Left, s.[0] == '&' && (not (s = "&")) && not (s = "&&")) ); + (TokenPrecedence, fun s -> (Left, s.[0] == '$')); + ]; + [ (CustomPrecedence, fun s -> (Left, s = funToken)) ]; + [ + (TokenPrecedence, fun s -> (Right, s = "&")); + (TokenPrecedence, fun s -> (Right, s = "&&")); + ]; + [ + (TokenPrecedence, fun s -> (Right, s = "or")); + (TokenPrecedence, fun s -> (Right, s = "||")); + ]; + [ + (* The Left shouldn't ever matter in practice. Should never get in a + situation with two consecutive infix ? - the colon saves us. *) + (TokenPrecedence, fun s -> (Left, s = "?")); + ]; + [ (TokenPrecedence, fun s -> (Right, s = ":=")) ]; + [ (TokenPrecedence, fun s -> (Right, s = updateToken)) ]; + (* It's important to account for ternary ":" being lower precedence than "?" *) + [ (TokenPrecedence, fun s -> (Right, s = ":")) ]; + [ (TokenPrecedence, fun s -> (Nonassoc, s = "=>")) ]; + ] + +(* remove all prefixing backslashes, e.g. \=== becomes === *) +let without_prefixed_backslashes str = + if str = "" then str + else if String.get str 0 = '\\' then String.sub str 1 (String.length str - 1) + else str + +let indexOfFirstMatch ~prec lst = + let rec aux n = function + | [] -> None + | [] :: tl -> aux (n + 1) tl + | ((kind, tester) :: hdTl) :: tl -> ( + match (prec, kind) with + | Token str, TokenPrecedence | Custom str, CustomPrecedence -> + let associativity, foundMatch = tester str in + if foundMatch then Some (associativity, n) else aux n (hdTl :: tl) + | _ -> aux n (hdTl :: tl)) + in + aux 0 lst + +(* Assuming it's an infix function application. *) +let precedenceInfo ~prec = + (* Removes prefixed backslashes in order to do proper conversion *) + let prec = + match prec with + | Token str -> Token (without_prefixed_backslashes str) + | Custom _ -> prec + in + indexOfFirstMatch ~prec rules + +let isLeftAssociative ~prec = + match precedenceInfo ~prec with + | None -> false + | Some (Left, _) -> true + | Some (Right, _) -> false + | Some (Nonassoc, _) -> false + +let isRightAssociative ~prec = + match precedenceInfo ~prec with + | None -> false + | Some (Right, _) -> true + | Some (Left, _) -> false + | Some (Nonassoc, _) -> false + +let higherPrecedenceThan c1 c2 = + match (precedenceInfo ~prec:c1, precedenceInfo ~prec:c2) with + | _, None | None, _ -> + let str1, str2 = + match (c1, c2) with + | Token s1, Token s2 -> ("Token " ^ s1, "Token " ^ s2) + | Token s1, Custom s2 -> ("Token " ^ s1, "Custom " ^ s2) + | Custom s1, Token s2 -> ("Custom " ^ s1, "Token " ^ s2) + | Custom s1, Custom s2 -> ("Custom " ^ s1, "Custom " ^ s2) + in + raise + (NotPossible + ("Cannot determine precedence of two checks " ^ str1 ^ " vs. " ^ str2)) + | Some (_, p1), Some (_, p2) -> p1 < p2 + +let printedStringAndFixityExpr = function + | { pexp_desc = Pexp_ident { txt = Lident l } } -> printedStringAndFixity l + | _ -> Normal + +(* which identifiers are in fact operators needing parentheses *) +let needs_parens txt = + match printedStringAndFixity txt with + | Infix _ -> true + | UnaryPostfix _ -> true + | UnaryPlusPrefix _ -> true + | UnaryMinusPrefix _ -> true + | UnaryNotPrefix _ -> true + | AlmostSimplePrefix _ -> true + | Letop _ -> true + | Andop _ -> true + | Normal -> false + +(* some infixes need spaces around parens to avoid clashes with comment + syntax. This isn't needed for comment syntax /* */ *) +let needs_spaces txt = txt.[0] = '*' || txt.[String.length txt - 1] = '*' + +let rec orList = function + (* only consider ((A|B)|C)*) + | { ppat_desc = Ppat_or (p1, p2) } -> orList p1 @ orList p2 + | x -> [ x ] + +let override = function Override -> "!" | Fresh -> "" + +(* variance encoding: need to sync up with the [parser.mly] *) +let type_variance = function + | Invariant -> "" + | Covariant -> "+" + | Contravariant -> "-" + +let moduleIdent ident = match ident.txt with None -> "_" | Some name -> name + +type construct = + [ `cons of expression list + | `list of expression list + | `nil + | `normal + | `simple of Longident.t + | `tuple ] + +let view_expr x = + match x.pexp_desc with + | Pexp_construct ({ txt = Lident "()" }, _) -> `tuple + | Pexp_construct ({ txt = Lident "[]" }, _) -> `nil + | Pexp_construct ({ txt = Lident "::" }, Some _) -> + let rec loop exp acc = + match exp with + | { pexp_desc = Pexp_construct ({ txt = Lident "[]" }, _) } -> + (List.rev acc, true) + | { + pexp_desc = + Pexp_construct + ({ txt = Lident "::" }, Some { pexp_desc = Pexp_tuple [ e1; e2 ] }); + } -> + loop e2 (e1 :: acc) + | e -> (List.rev (e :: acc), false) + in + let ls, b = loop x [] in + if b then `list ls else `cons ls + | Pexp_construct (x, None) -> `simple x.txt + | _ -> `normal + +let is_simple_list_expr x = + match view_expr x with `list _ | `cons _ -> true | _ -> false + +let is_simple_construct : construct -> bool = function + | `nil | `tuple | `list _ | `simple _ | `cons _ -> true + | `normal -> false + +let uncurriedTable = Hashtbl.create 42 + +(* Determines if a list of expressions contains a single unit construct + * e.g. used to check: MyConstructor() -> exprList == [()] + * useful to determine if MyConstructor(()) should be printed as MyConstructor() + * *) +let is_single_unit_construct exprList = + match exprList with + | x :: [] -> ( + let view = view_expr x in + match view with `tuple -> true | _ -> false) + | _ -> false + +let detectTernary l = + match l with + | [ + { + pc_lhs = { ppat_desc = Ppat_construct ({ txt = Lident "true" }, _) }; + pc_guard = None; + pc_rhs = ifTrue; + }; + { + pc_lhs = { ppat_desc = Ppat_construct ({ txt = Lident "false" }, _) }; + pc_guard = None; + pc_rhs = ifFalse; + }; + ] -> + Some (ifTrue, ifFalse) + | _ -> None type funcApplicationLabelStyle = (* No attaching to the label, but if the entire application fits on one line, @@ -165,6 +882,18 @@ let configure ~width ~assumeExplicitArity ~constructorLists = { defaultSettings with width; assumeExplicitArity; constructorLists } let settings = defaultSettings +let preserve_braces = true + +let should_preserve_requested_braces expr = + let { stylisticAttrs } = partitionAttributes expr.pexp_attributes in + match expr.pexp_desc with + | Pexp_ifthenelse _ | Pexp_try _ -> false + | Pexp_sequence _ -> + (* `let ... in` should _always_ preserve braces *) + true + | _ -> + preserve_braces + && Reason_attributes.has_preserve_braces_attrs stylisticAttrs let rec structure_item term = match term.pstr_desc with @@ -184,7 +913,11 @@ let rec structure_item term = ^^ semi) | Pstr_typext t -> string "todo Pstr_typext" | Pstr_exception e -> string "todo Pstr_exception" - | Pstr_module mb -> string "todo Pstr_module" + | Pstr_module mb -> + group + (string "module" ^^ space + ^^ optional string mb.pmb_name.txt + ^^ space ^^ equals ^^ space ^^ module_expr mb.pmb_expr) | Pstr_recmodule ml -> string "todo Pstr_recmodule" | Pstr_modtype mt -> string "todo Pstr_modtype" | Pstr_open o -> string "todo Pstr_open" @@ -194,6 +927,11 @@ let rec structure_item term = | Pstr_attribute a -> string "todo Pstr_attribute" | Pstr_extension (e, a) -> string "todo Pstr_extension" +and module_expr = function + | { pmod_desc = Pmod_structure s; _ } -> + lbrace ^^ structure s ^^ rbrace ^^ semi + | _ -> string "module_expr: todo" + and value_bindings rf vb = let attrs = List.map (fun b -> partitionAttributes b.pvb_attributes) vb in let fstAttrs, restAttrs = @@ -240,13 +978,35 @@ and value_binding { pvb_pat; pvb_expr; pvb_attributes; pvb_loc } = ^^ group (expression ~depth:2 pvb_expr) ^^ semi) -and arg_label = function +and arg_label (a : Compiler_libs.Asttypes.arg_label) = + match a with | Nolabel -> empty | Labelled s -> string "todo: Labelled" | Optional s -> string "todo: optional" and arrow = space ^^ equals ^^ rangle ^^ space +(* add parentheses to binders when they are in fact infix or prefix operators *) +and protectIdentifier txt = + let needs_parens = needs_parens txt in + let txt = + if is_andop txt || is_letop txt then + Reason_syntax_util.compress_letop_identifier txt + else txt + in + if not needs_parens then string txt + else if needs_spaces txt then group (lparen ^^ string txt ^^ rparen) + else string ("(" ^ txt ^ ")") + +and protectLongIdentifier longPrefix txt = + group (longPrefix ^^ string "." ^^ protectIdentifier txt) + +and longident = function + | Lident s -> protectIdentifier s + | Ldot (longPrefix, s) -> protectLongIdentifier (longident longPrefix) s + | Lapply (y, s) -> + group (longident y ^^ string "(" ^^ longident s ^^ string ")") + and constant c = let open OCaml in match c with @@ -259,11 +1019,13 @@ and constant c = | Pconst_float (i, None) -> float (float_of_string i) | Pconst_float (i, Some m) -> float (float_of_string i) -and expression ?(depth = 0) ?(wrap = true) - { pexp_desc; pexp_loc; pexp_loc_stack; pexp_attributes } = +and direction_flag (f : Compiler_libs.Asttypes.direction_flag) = + match f with Upto -> string "to" | Downto -> string "downto" + +and expression ?(depth = 0) ?(wrap = true) x = + let { pexp_desc; pexp_loc; pexp_loc_stack; pexp_attributes } = x in match pexp_desc with - | Pexp_ident { txt = Lident l } -> string l - | Pexp_ident _ -> string "todo pexident" + | Pexp_ident { txt } -> longident txt | Pexp_constant c -> constant c | Pexp_let (rf, vb, e) -> break 0 ^^ value_bindings rf vb ^^ break 1 ^^ expression e ^^ semi @@ -290,23 +1052,35 @@ and expression ?(depth = 0) ?(wrap = true) (parens (separate (comma ^^ space) (List.rev lst)), callback) | _ -> (string "pepxfun: not supported yet", string "not supported yet") in + let shouldPreserveBraces = should_preserve_requested_braces e2 in + let callback = + if shouldPreserveBraces then + nest 2 (lbrace ^^ break 1 ^^ callback) ^^ break 0 ^^ rbrace + else callback + in arg_label a ^^ args ^^ arrow ^^ callback | Pexp_apply ( ({ pexp_desc = Pexp_ident { txt = Lident i; _ }; _ } as infixOperator), - [ (_, a); (_, b) ] ) - when isInfix i -> - expression a ^^ space ^^ expression infixOperator ^^ space ^^ expression b + [ (_, a); (_, b) ] ) -> ( + match printedStringAndFixity i with + | Infix o -> expression a ^^ space ^^ string o ^^ space ^^ expression b + | _ -> + expression a ^^ space ^^ expression infixOperator ^^ space + ^^ expression b) | Pexp_apply (e, l) -> - group - (break 0 ^^ expression e ^^ string "(" - ^^ nest 2 - (break 0 - ^^ separate_map - (comma ^^ break 1) - (fun (_, e) -> expression ~wrap:false e) - l - ^^ ifflat empty comma) - ^^ break 0 ^^ string ")") + ifflat + (expression e ^^ string "(" + ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l) + (group + (break 0 ^^ expression e ^^ string "(" + ^^ nest 2 + (break 0 + ^^ separate_map + (comma ^^ break 1) + (fun (_, e) -> expression ~wrap:false e) + l + ^^ ifflat empty (if List.length l = 1 then empty else comma)) + ^^ break 0 ^^ string ")")) | Pexp_match (e, cl) -> group (nest depth @@ -322,8 +1096,14 @@ and expression ?(depth = 0) ?(wrap = true) ^^ separate_map (comma ^^ break 1) expression el ^^ ifflat empty comma) ^^ break 0 ^^ rparen - | Pexp_construct ({ txt = Lident "()" }, None) -> - if wrap then empty else string "()" + | Pexp_construct _ when is_simple_construct (view_expr x) -> ( + match view_expr x with + | `nil -> string "[]" + | `tuple -> string "()" + | `list xs -> string "Pexp_construct list" + | `cons xs -> string "Pexp_construct cons" + | `simple x -> longident x + | _ -> assert false) | Pexp_construct ({ txt = Lident s1 }, opt) -> group (string s1 ^^ optional (expression ~wrap:true) opt) | Pexp_construct (_, opt) -> string "todo Pexp_construct" @@ -349,9 +1129,17 @@ and expression ?(depth = 0) ?(wrap = true) | Pexp_setfield (e, l, e2) -> string "todo Pexp_setfield" | Pexp_array el -> string "todo Pexp_array" | Pexp_ifthenelse (e1, e2, e3) -> string "todo Pexp_ifthenelse" - | Pexp_sequence (e1, e2) -> string "todo Pexp_sequence" - | Pexp_while (e1, e2) -> string "todo Pexp_while" - | Pexp_for (p, e1, e2, d, e3) -> string "todo Pexp_for" + | Pexp_sequence (e1, e2) -> expression e1 ^^ semi ^^ hardline ^^ expression e2 + | Pexp_while (e1, e2) -> + string "while" ^^ space ^^ lparen ^^ expression e1 ^^ rparen ^^ space + ^^ nest 2 (lbrace ^^ break 1 ^^ expression e2) + ^^ break 1 ^^ rbrace + | Pexp_for (p, e1, e2, d, e3) -> + string "for" ^^ space ^^ lparen ^^ pattern p ^^ space ^^ string "in" + ^^ space ^^ expression e1 ^^ space ^^ direction_flag d ^^ space + ^^ expression e2 ^^ rparen ^^ space + ^^ nest 2 (lbrace ^^ break 1 ^^ expression e3) + ^^ break 1 ^^ rbrace | Pexp_constraint (e1, c) -> lparen ^^ expression e1 ^^ colon ^^ space ^^ core_type c ^^ rparen | Pexp_coerce (e, c, c2) -> string "todo Pexp_coerce" @@ -423,8 +1211,7 @@ and pattern ?(wrap = true) (comma ^^ space ^^ dot ^^ dot ^^ dot) (List.map pattern (pat_list @ [ pat_last ])) ^^ rbracket) - | Ppat_construct ({ txt = Lident "()" }, None) -> - if wrap then empty else string "()" + | Ppat_construct ({ txt = Lident "()" }, None) -> string "()" | Ppat_construct ({ txt = Lident s }, c) -> string s ^^ optional (fun f -> pattern (snd f)) c | Ppat_construct (s, s2) -> string "todo Ppatconstruct" diff --git a/test/basicStructures.t/run.t.ast b/test/basicStructures.t/run.t.ast new file mode 100644 index 000000000..a82cc9908 --- /dev/null +++ b/test/basicStructures.t/run.t.ast @@ -0,0 +1,6635 @@ +[ + structure_item (test/basicStructures.t/input.re[3,71+0]..[3,71+65]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[3,71+4]..[3,71+7]) + Ppat_var "run" (test/basicStructures.t/input.re[3,71+4]..[3,71+7]) + expression (test/basicStructures.t/input.re[3,71+10]..[3,71+65]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[3,71+14]..[3,71+16]) + Ppat_construct "()" (test/basicStructures.t/input.re[3,71+14]..[3,71+16]) + None + expression (test/basicStructures.t/input.re[3,71+20]..[3,71+65]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[3,71+21]..[3,71+43]) + Pexp_ident "TestUtils.printSection" (test/basicStructures.t/input.re[3,71+21]..[3,71+43]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[3,71+44]..[3,71+62]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Basic Structures",(test/basicStructures.t/input.re[3,71+44]..[3,71+62]),None) + ] + Pexp_constant PConst_string("Basic Structures",(test/basicStructures.t/input.re[3,71+44]..[3,71+62]),None) + ] + ] + structure_item (test/basicStructures.t/input.re[5,139+0]..[8,222+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[5,139+0]..[8,222+1]) + Pexp_while + expression (test/basicStructures.t/input.re[5,139+6]..[5,139+17]) + Pexp_ident "something" (test/basicStructures.t/input.re[5,139+7]..[5,139+16]) + expression (test/basicStructures.t/input.re[5,139+18]..[8,222+1]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[6,159+2]..[6,159+41]) + Pexp_apply + expression (test/basicStructures.t/input.re[6,159+2]..[6,159+14]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[6,159+2]..[6,159+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[6,159+16]..[6,159+40]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("You're in a while loop",(test/basicStructures.t/input.re[6,159+16]..[6,159+40]),None) + ] + Pexp_constant PConst_string("You're in a while loop",(test/basicStructures.t/input.re[6,159+16]..[6,159+40]),None) + ] + expression (test/basicStructures.t/input.re[7,202+2]..[7,202+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[7,202+2]..[7,202+15]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[7,202+2]..[7,202+15]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[7,202+16]..[7,202+18]) + Pexp_construct "()" (test/basicStructures.t/input.re[7,202+16]..[7,202+18]) + None + ] + structure_item (test/basicStructures.t/input.re[10,226+0]..[17,389+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[10,226+0]..[17,389+1]) + Pexp_for Up + pattern (test/basicStructures.t/input.re[10,226+5]..[10,226+6]) + Ppat_var "i" (test/basicStructures.t/input.re[10,226+5]..[10,226+6]) + expression (test/basicStructures.t/input.re[10,226+10]..[10,226+11]) + Pexp_constant PConst_int (0,None) + expression (test/basicStructures.t/input.re[10,226+15]..[10,226+16]) + Pexp_constant PConst_int (5,None) + expression (test/basicStructures.t/input.re[10,226+18]..[17,389+1]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[11,246+2]..[11,246+15]) + Pexp_apply + expression (test/basicStructures.t/input.re[11,246+2]..[11,246+11]) + Pexp_ident "print_int" (test/basicStructures.t/input.re[11,246+2]..[11,246+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[11,246+13]..[11,246+14]) + Pexp_ident "i" (test/basicStructures.t/input.re[11,246+13]..[11,246+14]) + ] + expression (test/basicStructures.t/input.re[12,263+2]..[16,384+4]) + Pexp_sequence + expression (test/basicStructures.t/input.re[12,263+2]..[12,263+18]) + Pexp_apply + expression (test/basicStructures.t/input.re[12,263+2]..[12,263+15]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[12,263+2]..[12,263+15]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[12,263+16]..[12,263+18]) + Pexp_construct "()" (test/basicStructures.t/input.re[12,263+16]..[12,263+18]) + None + ] + expression (test/basicStructures.t/input.re[13,283+2]..[16,384+4]) + Pexp_for Down + pattern (test/basicStructures.t/input.re[13,283+7]..[13,283+8]) + Ppat_var "i" (test/basicStructures.t/input.re[13,283+7]..[13,283+8]) + expression (test/basicStructures.t/input.re[13,283+12]..[13,283+14]) + Pexp_constant PConst_int (10,None) + expression (test/basicStructures.t/input.re[13,283+22]..[13,283+23]) + Pexp_constant PConst_int (0,None) + expression (test/basicStructures.t/input.re[13,283+25]..[16,384+3]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[14,310+4]..[14,310+50]) + Pexp_apply + expression (test/basicStructures.t/input.re[14,310+4]..[14,310+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[14,310+4]..[14,310+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[14,310+18]..[14,310+49]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Counting in reverse direction",(test/basicStructures.t/input.re[14,310+18]..[14,310+49]),None) + ] + Pexp_constant PConst_string("Counting in reverse direction",(test/basicStructures.t/input.re[14,310+18]..[14,310+49]),None) + ] + expression (test/basicStructures.t/input.re[15,362+4]..[15,362+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[15,362+4]..[15,362+17]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[15,362+4]..[15,362+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[15,362+18]..[15,362+20]) + Pexp_construct "()" (test/basicStructures.t/input.re[15,362+18]..[15,362+20]) + None + ] + structure_item (test/basicStructures.t/input.re[19,393+0]..[26,622+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[19,393+0]..[26,622+1]) + Pexp_for Up + pattern (test/basicStructures.t/input.re[19,393+5]..[19,393+6]) + Ppat_var "i" (test/basicStructures.t/input.re[19,393+5]..[19,393+6]) + expression (test/basicStructures.t/input.re[19,393+10]..[19,393+11]) + Pexp_constant PConst_int (0,None) + expression (test/basicStructures.t/input.re[19,393+15]..[19,393+50]) + Pexp_apply + expression (test/basicStructures.t/input.re[19,393+15]..[19,393+37]) + Pexp_ident "endOfRangeMustBeSimple" (test/basicStructures.t/input.re[19,393+15]..[19,393+37]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[19,393+38]..[19,393+42]) + Pexp_ident "expr" (test/basicStructures.t/input.re[19,393+38]..[19,393+42]) + + Nolabel + expression (test/basicStructures.t/input.re[19,393+43]..[19,393+49]) + Pexp_ident "soWrap" (test/basicStructures.t/input.re[19,393+43]..[19,393+49]) + ] + expression (test/basicStructures.t/input.re[19,393+52]..[26,622+1]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[20,447+2]..[20,447+15]) + Pexp_apply + expression (test/basicStructures.t/input.re[20,447+2]..[20,447+11]) + Pexp_ident "print_int" (test/basicStructures.t/input.re[20,447+2]..[20,447+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[20,447+13]..[20,447+14]) + Pexp_ident "i" (test/basicStructures.t/input.re[20,447+13]..[20,447+14]) + ] + expression (test/basicStructures.t/input.re[21,464+2]..[25,617+4]) + Pexp_sequence + expression (test/basicStructures.t/input.re[21,464+2]..[21,464+18]) + Pexp_apply + expression (test/basicStructures.t/input.re[21,464+2]..[21,464+15]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[21,464+2]..[21,464+15]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[21,464+16]..[21,464+18]) + Pexp_construct "()" (test/basicStructures.t/input.re[21,464+16]..[21,464+18]) + None + ] + expression (test/basicStructures.t/input.re[22,484+2]..[25,617+4]) + Pexp_for Down + pattern (test/basicStructures.t/input.re[22,484+7]..[22,484+8]) + Ppat_var "i" (test/basicStructures.t/input.re[22,484+7]..[22,484+8]) + expression (test/basicStructures.t/input.re[22,484+12]..[22,484+46]) + Pexp_apply + expression (test/basicStructures.t/input.re[22,484+12]..[22,484+19]) + Pexp_ident "theSame" (test/basicStructures.t/input.re[22,484+12]..[22,484+19]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[22,484+20]..[22,484+26]) + Pexp_ident "isTrue" (test/basicStructures.t/input.re[22,484+20]..[22,484+26]) + + Nolabel + expression (test/basicStructures.t/input.re[22,484+27]..[22,484+32]) + Pexp_ident "ofThe" (test/basicStructures.t/input.re[22,484+27]..[22,484+32]) + + Nolabel + expression (test/basicStructures.t/input.re[22,484+33]..[22,484+45]) + Pexp_ident "startOfRange" (test/basicStructures.t/input.re[22,484+33]..[22,484+45]) + ] + expression (test/basicStructures.t/input.re[22,484+54]..[22,484+55]) + Pexp_constant PConst_int (0,None) + expression (test/basicStructures.t/input.re[22,484+57]..[25,617+3]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[23,543+4]..[23,543+50]) + Pexp_apply + expression (test/basicStructures.t/input.re[23,543+4]..[23,543+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[23,543+4]..[23,543+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[23,543+18]..[23,543+49]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Counting in reverse direction",(test/basicStructures.t/input.re[23,543+18]..[23,543+49]),None) + ] + Pexp_constant PConst_string("Counting in reverse direction",(test/basicStructures.t/input.re[23,543+18]..[23,543+49]),None) + ] + expression (test/basicStructures.t/input.re[24,595+4]..[24,595+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[24,595+4]..[24,595+17]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[24,595+4]..[24,595+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[24,595+18]..[24,595+20]) + Pexp_construct "()" (test/basicStructures.t/input.re[24,595+18]..[24,595+20]) + None + ] + structure_item (test/basicStructures.t/input.re[28,626+0]..[28,626+20]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[28,626+4]..[28,626+5]) + Ppat_var "x" (test/basicStructures.t/input.re[28,626+4]..[28,626+5]) + expression (test/basicStructures.t/input.re[28,626+8]..[28,626+20]) + Pexp_apply + expression (test/basicStructures.t/input.re[28,626+19]..[28,626+20]) + Pexp_ident "!" (test/basicStructures.t/input.re[28,626+19]..[28,626+20]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[28,626+8]..[28,626+19]) + Pexp_field + expression (test/basicStructures.t/input.re[28,626+8]..[28,626+15]) + Pexp_apply + expression (test/basicStructures.t/input.re[28,626+14]..[28,626+15]) + Pexp_ident "!" (test/basicStructures.t/input.re[28,626+14]..[28,626+15]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[28,626+8]..[28,626+14]) + Pexp_apply + expression (test/basicStructures.t/input.re[28,626+12]..[28,626+13]) + Pexp_ident "!" (test/basicStructures.t/input.re[28,626+12]..[28,626+13]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[28,626+9]..[28,626+12]) + Pexp_ident "foo" (test/basicStructures.t/input.re[28,626+9]..[28,626+12]) + ] + ] + "bar" (test/basicStructures.t/input.re[28,626+16]..[28,626+19]) + ] + ] + structure_item (test/basicStructures.t/input.re[30,649+0]..[30,649+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[30,649+4]..[30,649+5]) + Ppat_var "x" (test/basicStructures.t/input.re[30,649+4]..[30,649+5]) + expression (test/basicStructures.t/input.re[30,649+8]..[30,649+16]) + Pexp_apply + expression (test/basicStructures.t/input.re[30,649+15]..[30,649+16]) + Pexp_ident "!" (test/basicStructures.t/input.re[30,649+15]..[30,649+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[30,649+8]..[30,649+15]) + Pexp_field + expression (test/basicStructures.t/input.re[30,649+8]..[30,649+11]) + Pexp_ident "foo" (test/basicStructures.t/input.re[30,649+8]..[30,649+11]) + "bar" (test/basicStructures.t/input.re[30,649+12]..[30,649+15]) + ] + ] + structure_item (test/basicStructures.t/input.re[32,668+0]..[32,668+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[32,668+4]..[32,668+5]) + Ppat_var "x" (test/basicStructures.t/input.re[32,668+4]..[32,668+5]) + expression (test/basicStructures.t/input.re[32,668+8]..[32,668+16]) + Pexp_apply + expression (test/basicStructures.t/input.re[32,668+15]..[32,668+16]) + Pexp_ident "!" (test/basicStructures.t/input.re[32,668+15]..[32,668+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[32,668+8]..[32,668+15]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[32,668+8]..[32,668+11]) + Pexp_ident "foo" (test/basicStructures.t/input.re[32,668+8]..[32,668+11]) + ] + ] + structure_item (test/basicStructures.t/input.re[34,687+0]..[34,687+17]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[34,687+4]..[34,687+5]) + Ppat_var "x" (test/basicStructures.t/input.re[34,687+4]..[34,687+5]) + expression (test/basicStructures.t/input.re[34,687+8]..[34,687+17]) + Pexp_apply + expression (test/basicStructures.t/input.re[34,687+16]..[34,687+17]) + Pexp_ident "!" (test/basicStructures.t/input.re[34,687+16]..[34,687+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[34,687+8]..[34,687+16]) + Pexp_field + expression (test/basicStructures.t/input.re[34,687+8]..[34,687+12]) + Pexp_apply + expression (test/basicStructures.t/input.re[34,687+11]..[34,687+12]) + Pexp_ident "!" (test/basicStructures.t/input.re[34,687+11]..[34,687+12]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[34,687+8]..[34,687+11]) + Pexp_ident "foo" (test/basicStructures.t/input.re[34,687+8]..[34,687+11]) + ] + "bar" (test/basicStructures.t/input.re[34,687+13]..[34,687+16]) + ] + ] + structure_item (test/basicStructures.t/input.re[36,707+0]..[36,707+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[36,707+4]..[36,707+5]) + Ppat_var "x" (test/basicStructures.t/input.re[36,707+4]..[36,707+5]) + expression (test/basicStructures.t/input.re[36,707+8]..[36,707+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[36,707+18]..[36,707+19]) + Pexp_ident "!" (test/basicStructures.t/input.re[36,707+18]..[36,707+19]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[36,707+8]..[36,707+18]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[36,707+8]..[36,707+14]) + Pexp_apply + expression (test/basicStructures.t/input.re[36,707+12]..[36,707+13]) + Pexp_ident "!" (test/basicStructures.t/input.re[36,707+12]..[36,707+13]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[36,707+9]..[36,707+12]) + Pexp_ident "foo" (test/basicStructures.t/input.re[36,707+9]..[36,707+12]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[43,908+0]..[43,908+21]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[43,908+4]..[43,908+5]) + Ppat_var "x" (test/basicStructures.t/input.re[43,908+4]..[43,908+5]) + expression (test/basicStructures.t/input.re[43,908+8]..[43,908+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[43,908+8]..[43,908+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[43,908+8]..[43,908+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[43,908+9]..[43,908+21]) + Pexp_field + expression (test/basicStructures.t/input.re[43,908+9]..[43,908+17]) + Pexp_apply + expression (test/basicStructures.t/input.re[43,908+10]..[43,908+11]) + Pexp_ident "not" (test/basicStructures.t/input.re[43,908+10]..[43,908+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[43,908+12]..[43,908+16]) + Pexp_apply + expression (test/basicStructures.t/input.re[43,908+12]..[43,908+13]) + Pexp_ident "not" (test/basicStructures.t/input.re[43,908+12]..[43,908+13]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[43,908+13]..[43,908+16]) + Pexp_ident "foo" (test/basicStructures.t/input.re[43,908+13]..[43,908+16]) + ] + ] + "bar" (test/basicStructures.t/input.re[43,908+18]..[43,908+21]) + ] + ] + structure_item (test/basicStructures.t/input.re[45,932+0]..[45,932+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[45,932+4]..[45,932+5]) + Ppat_var "x" (test/basicStructures.t/input.re[45,932+4]..[45,932+5]) + expression (test/basicStructures.t/input.re[45,932+8]..[45,932+16]) + Pexp_apply + expression (test/basicStructures.t/input.re[45,932+8]..[45,932+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[45,932+8]..[45,932+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[45,932+9]..[45,932+16]) + Pexp_field + expression (test/basicStructures.t/input.re[45,932+9]..[45,932+12]) + Pexp_ident "foo" (test/basicStructures.t/input.re[45,932+9]..[45,932+12]) + "bar" (test/basicStructures.t/input.re[45,932+13]..[45,932+16]) + ] + ] + structure_item (test/basicStructures.t/input.re[47,951+0]..[47,951+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[47,951+4]..[47,951+5]) + Ppat_var "x" (test/basicStructures.t/input.re[47,951+4]..[47,951+5]) + expression (test/basicStructures.t/input.re[47,951+8]..[47,951+16]) + Pexp_apply + expression (test/basicStructures.t/input.re[47,951+8]..[47,951+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[47,951+8]..[47,951+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[47,951+9]..[47,951+16]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[47,951+9]..[47,951+12]) + Pexp_ident "foo" (test/basicStructures.t/input.re[47,951+9]..[47,951+12]) + ] + ] + structure_item (test/basicStructures.t/input.re[49,970+0]..[49,970+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[49,970+4]..[49,970+5]) + Ppat_var "x" (test/basicStructures.t/input.re[49,970+4]..[49,970+5]) + expression (test/basicStructures.t/input.re[49,970+8]..[49,970+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[49,970+8]..[49,970+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[49,970+8]..[49,970+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[49,970+9]..[49,970+19]) + Pexp_field + expression (test/basicStructures.t/input.re[49,970+9]..[49,970+15]) + Pexp_apply + expression (test/basicStructures.t/input.re[49,970+10]..[49,970+11]) + Pexp_ident "not" (test/basicStructures.t/input.re[49,970+10]..[49,970+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[49,970+11]..[49,970+14]) + Pexp_ident "foo" (test/basicStructures.t/input.re[49,970+11]..[49,970+14]) + ] + "bar" (test/basicStructures.t/input.re[49,970+16]..[49,970+19]) + ] + ] + structure_item (test/basicStructures.t/input.re[51,992+0]..[51,992+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[51,992+4]..[51,992+5]) + Ppat_var "x" (test/basicStructures.t/input.re[51,992+4]..[51,992+5]) + expression (test/basicStructures.t/input.re[51,992+8]..[51,992+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[51,992+8]..[51,992+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[51,992+8]..[51,992+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[51,992+9]..[51,992+19]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[51,992+9]..[51,992+15]) + Pexp_apply + expression (test/basicStructures.t/input.re[51,992+10]..[51,992+11]) + Pexp_ident "not" (test/basicStructures.t/input.re[51,992+10]..[51,992+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[51,992+11]..[51,992+14]) + Pexp_ident "foo" (test/basicStructures.t/input.re[51,992+11]..[51,992+14]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[53,1014+0]..[53,1014+18]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[53,1014+4]..[53,1014+5]) + Ppat_var "x" (test/basicStructures.t/input.re[53,1014+4]..[53,1014+5]) + expression (test/basicStructures.t/input.re[53,1014+8]..[53,1014+18]) + Pexp_apply + expression (test/basicStructures.t/input.re[53,1014+8]..[53,1014+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[53,1014+8]..[53,1014+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[53,1014+10]..[53,1014+18]) + Pexp_apply + expression (test/basicStructures.t/input.re[53,1014+10]..[53,1014+11]) + Pexp_ident "not" (test/basicStructures.t/input.re[53,1014+10]..[53,1014+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[53,1014+11]..[53,1014+18]) + Pexp_field + expression (test/basicStructures.t/input.re[53,1014+11]..[53,1014+14]) + Pexp_ident "foo" (test/basicStructures.t/input.re[53,1014+11]..[53,1014+14]) + "bar" (test/basicStructures.t/input.re[53,1014+15]..[53,1014+18]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[55,1035+0]..[55,1035+21]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[55,1035+4]..[55,1035+5]) + Ppat_var "x" (test/basicStructures.t/input.re[55,1035+4]..[55,1035+5]) + expression (test/basicStructures.t/input.re[55,1035+8]..[55,1035+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[55,1035+8]..[55,1035+10]) + Pexp_ident "?!" (test/basicStructures.t/input.re[55,1035+8]..[55,1035+10]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[55,1035+11]..[55,1035+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[55,1035+12]..[55,1035+13]) + Pexp_ident "not" (test/basicStructures.t/input.re[55,1035+12]..[55,1035+13]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[55,1035+13]..[55,1035+20]) + Pexp_field + expression (test/basicStructures.t/input.re[55,1035+13]..[55,1035+16]) + Pexp_ident "foo" (test/basicStructures.t/input.re[55,1035+13]..[55,1035+16]) + "bar" (test/basicStructures.t/input.re[55,1035+17]..[55,1035+20]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[57,1059+0]..[57,1059+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[57,1059+4]..[57,1059+5]) + Ppat_var "x" (test/basicStructures.t/input.re[57,1059+4]..[57,1059+5]) + expression (test/basicStructures.t/input.re[57,1059+8]..[57,1059+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[57,1059+8]..[57,1059+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[57,1059+8]..[57,1059+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[57,1059+10]..[57,1059+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[57,1059+10]..[57,1059+12]) + Pexp_ident "?!" (test/basicStructures.t/input.re[57,1059+10]..[57,1059+12]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[57,1059+12]..[57,1059+19]) + Pexp_field + expression (test/basicStructures.t/input.re[57,1059+12]..[57,1059+15]) + Pexp_ident "foo" (test/basicStructures.t/input.re[57,1059+12]..[57,1059+15]) + "bar" (test/basicStructures.t/input.re[57,1059+16]..[57,1059+19]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[59,1081+0]..[59,1081+21]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[59,1081+4]..[59,1081+5]) + Ppat_var "x" (test/basicStructures.t/input.re[59,1081+4]..[59,1081+5]) + expression (test/basicStructures.t/input.re[59,1081+8]..[59,1081+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[59,1081+8]..[59,1081+10]) + Pexp_ident "~!" (test/basicStructures.t/input.re[59,1081+8]..[59,1081+10]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[59,1081+11]..[59,1081+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[59,1081+12]..[59,1081+13]) + Pexp_ident "not" (test/basicStructures.t/input.re[59,1081+12]..[59,1081+13]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[59,1081+13]..[59,1081+20]) + Pexp_field + expression (test/basicStructures.t/input.re[59,1081+13]..[59,1081+16]) + Pexp_ident "foo" (test/basicStructures.t/input.re[59,1081+13]..[59,1081+16]) + "bar" (test/basicStructures.t/input.re[59,1081+17]..[59,1081+20]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[61,1105+0]..[61,1105+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[61,1105+4]..[61,1105+5]) + Ppat_var "x" (test/basicStructures.t/input.re[61,1105+4]..[61,1105+5]) + expression (test/basicStructures.t/input.re[61,1105+8]..[61,1105+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[61,1105+8]..[61,1105+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[61,1105+8]..[61,1105+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[61,1105+10]..[61,1105+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[61,1105+10]..[61,1105+12]) + Pexp_ident "~!" (test/basicStructures.t/input.re[61,1105+10]..[61,1105+12]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[61,1105+12]..[61,1105+19]) + Pexp_field + expression (test/basicStructures.t/input.re[61,1105+12]..[61,1105+15]) + Pexp_ident "foo" (test/basicStructures.t/input.re[61,1105+12]..[61,1105+15]) + "bar" (test/basicStructures.t/input.re[61,1105+16]..[61,1105+19]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[63,1127+0]..[63,1127+20]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[63,1127+4]..[63,1127+5]) + Ppat_var "x" (test/basicStructures.t/input.re[63,1127+4]..[63,1127+5]) + expression (test/basicStructures.t/input.re[63,1127+8]..[63,1127+20]) + Pexp_apply + expression (test/basicStructures.t/input.re[63,1127+8]..[63,1127+10]) + Pexp_ident "~!" (test/basicStructures.t/input.re[63,1127+8]..[63,1127+10]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[63,1127+11]..[63,1127+20]) + Pexp_apply + expression (test/basicStructures.t/input.re[63,1127+11]..[63,1127+13]) + Pexp_ident "~!" (test/basicStructures.t/input.re[63,1127+11]..[63,1127+13]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[63,1127+13]..[63,1127+20]) + Pexp_field + expression (test/basicStructures.t/input.re[63,1127+13]..[63,1127+16]) + Pexp_ident "foo" (test/basicStructures.t/input.re[63,1127+13]..[63,1127+16]) + "bar" (test/basicStructures.t/input.re[63,1127+17]..[63,1127+20]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[65,1150+0]..[65,1150+17]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[65,1150+4]..[65,1150+5]) + Ppat_var "x" (test/basicStructures.t/input.re[65,1150+4]..[65,1150+5]) + expression (test/basicStructures.t/input.re[65,1150+8]..[65,1150+17]) + Pexp_apply + expression (test/basicStructures.t/input.re[65,1150+8]..[65,1150+10]) + Pexp_ident "!!" (test/basicStructures.t/input.re[65,1150+8]..[65,1150+10]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[65,1150+10]..[65,1150+17]) + Pexp_field + expression (test/basicStructures.t/input.re[65,1150+10]..[65,1150+13]) + Pexp_ident "foo" (test/basicStructures.t/input.re[65,1150+10]..[65,1150+13]) + "bar" (test/basicStructures.t/input.re[65,1150+14]..[65,1150+17]) + ] + ] + structure_item (test/basicStructures.t/input.re[67,1170+0]..[67,1170+17]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[67,1170+4]..[67,1170+5]) + Ppat_var "x" (test/basicStructures.t/input.re[67,1170+4]..[67,1170+5]) + expression (test/basicStructures.t/input.re[67,1170+8]..[67,1170+17]) + Pexp_apply + expression (test/basicStructures.t/input.re[67,1170+8]..[67,1170+10]) + Pexp_ident "!!" (test/basicStructures.t/input.re[67,1170+8]..[67,1170+10]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[67,1170+10]..[67,1170+17]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[67,1170+10]..[67,1170+13]) + Pexp_ident "foo" (test/basicStructures.t/input.re[67,1170+10]..[67,1170+13]) + ] + ] + structure_item (test/basicStructures.t/input.re[69,1190+0]..[69,1190+17]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[69,1190+4]..[69,1190+5]) + Ppat_var "x" (test/basicStructures.t/input.re[69,1190+4]..[69,1190+5]) + expression (test/basicStructures.t/input.re[69,1190+8]..[69,1190+17]) + Pexp_apply + expression (test/basicStructures.t/input.re[69,1190+8]..[69,1190+10]) + Pexp_ident "!~" (test/basicStructures.t/input.re[69,1190+8]..[69,1190+10]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[69,1190+10]..[69,1190+17]) + Pexp_field + expression (test/basicStructures.t/input.re[69,1190+10]..[69,1190+13]) + Pexp_ident "foo" (test/basicStructures.t/input.re[69,1190+10]..[69,1190+13]) + "bar" (test/basicStructures.t/input.re[69,1190+14]..[69,1190+17]) + ] + ] + structure_item (test/basicStructures.t/input.re[71,1210+0]..[71,1210+17]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[71,1210+4]..[71,1210+5]) + Ppat_var "x" (test/basicStructures.t/input.re[71,1210+4]..[71,1210+5]) + expression (test/basicStructures.t/input.re[71,1210+8]..[71,1210+17]) + Pexp_apply + expression (test/basicStructures.t/input.re[71,1210+8]..[71,1210+10]) + Pexp_ident "!~" (test/basicStructures.t/input.re[71,1210+8]..[71,1210+10]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[71,1210+10]..[71,1210+17]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[71,1210+10]..[71,1210+13]) + Pexp_ident "foo" (test/basicStructures.t/input.re[71,1210+10]..[71,1210+13]) + ] + ] + structure_item (test/basicStructures.t/input.re[73,1230+0]..[73,1230+34]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[73,1230+4]..[73,1230+18]) + Ppat_var "noParensNeeded" (test/basicStructures.t/input.re[73,1230+4]..[73,1230+18]) + expression (test/basicStructures.t/input.re[73,1230+21]..[73,1230+34]) + Pexp_apply + expression (test/basicStructures.t/input.re[73,1230+21]..[73,1230+22]) + Pexp_ident "not" (test/basicStructures.t/input.re[73,1230+21]..[73,1230+22]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[73,1230+22]..[73,1230+34]) + Pexp_field + expression (test/basicStructures.t/input.re[73,1230+22]..[73,1230+30]) + Pexp_field + expression (test/basicStructures.t/input.re[73,1230+22]..[73,1230+26]) + Pexp_ident "blah" (test/basicStructures.t/input.re[73,1230+22]..[73,1230+26]) + "foo" (test/basicStructures.t/input.re[73,1230+27]..[73,1230+30]) + "bar" (test/basicStructures.t/input.re[73,1230+31]..[73,1230+34]) + ] + ] + structure_item (test/basicStructures.t/input.re[75,1267+0]..[75,1267+45]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[75,1267+4]..[75,1267+27]) + Ppat_var "parensNeededAroundFirst" (test/basicStructures.t/input.re[75,1267+4]..[75,1267+27]) + expression (test/basicStructures.t/input.re[75,1267+30]..[75,1267+45]) + Pexp_field + expression (test/basicStructures.t/input.re[75,1267+30]..[75,1267+41]) + Pexp_field + expression (test/basicStructures.t/input.re[75,1267+30]..[75,1267+37]) + Pexp_apply + expression (test/basicStructures.t/input.re[75,1267+31]..[75,1267+32]) + Pexp_ident "not" (test/basicStructures.t/input.re[75,1267+31]..[75,1267+32]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[75,1267+32]..[75,1267+36]) + Pexp_ident "blah" (test/basicStructures.t/input.re[75,1267+32]..[75,1267+36]) + ] + "foo" (test/basicStructures.t/input.re[75,1267+38]..[75,1267+41]) + "bar" (test/basicStructures.t/input.re[75,1267+42]..[75,1267+45]) + ] + structure_item (test/basicStructures.t/input.re[77,1315+0]..[77,1315+46]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[77,1315+4]..[77,1315+28]) + Ppat_var "parensNeededAroundSecond" (test/basicStructures.t/input.re[77,1315+4]..[77,1315+28]) + expression (test/basicStructures.t/input.re[77,1315+31]..[77,1315+46]) + Pexp_field + expression (test/basicStructures.t/input.re[77,1315+31]..[77,1315+42]) + Pexp_apply + expression (test/basicStructures.t/input.re[77,1315+32]..[77,1315+33]) + Pexp_ident "not" (test/basicStructures.t/input.re[77,1315+32]..[77,1315+33]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[77,1315+33]..[77,1315+41]) + Pexp_field + expression (test/basicStructures.t/input.re[77,1315+33]..[77,1315+37]) + Pexp_ident "blah" (test/basicStructures.t/input.re[77,1315+33]..[77,1315+37]) + "foo" (test/basicStructures.t/input.re[77,1315+38]..[77,1315+41]) + ] + "bar" (test/basicStructures.t/input.re[77,1315+43]..[77,1315+46]) + ] + structure_item (test/basicStructures.t/input.re[79,1364+0]..[79,1364+34]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[79,1364+4]..[79,1364+18]) + Ppat_var "noParensNeeded" (test/basicStructures.t/input.re[79,1364+4]..[79,1364+18]) + expression (test/basicStructures.t/input.re[79,1364+21]..[79,1364+34]) + Pexp_apply + expression (test/basicStructures.t/input.re[79,1364+21]..[79,1364+22]) + Pexp_ident "not" (test/basicStructures.t/input.re[79,1364+21]..[79,1364+22]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[79,1364+22]..[79,1364+34]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[79,1364+22]..[79,1364+30]) + Pexp_send "foo" + expression (test/basicStructures.t/input.re[79,1364+22]..[79,1364+26]) + Pexp_ident "blah" (test/basicStructures.t/input.re[79,1364+22]..[79,1364+26]) + ] + ] + structure_item (test/basicStructures.t/input.re[81,1401+0]..[81,1401+45]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[81,1401+4]..[81,1401+27]) + Ppat_var "parensNeededAroundFirst" (test/basicStructures.t/input.re[81,1401+4]..[81,1401+27]) + expression (test/basicStructures.t/input.re[81,1401+30]..[81,1401+45]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[81,1401+30]..[81,1401+41]) + Pexp_send "foo" + expression (test/basicStructures.t/input.re[81,1401+30]..[81,1401+37]) + Pexp_apply + expression (test/basicStructures.t/input.re[81,1401+31]..[81,1401+32]) + Pexp_ident "not" (test/basicStructures.t/input.re[81,1401+31]..[81,1401+32]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[81,1401+32]..[81,1401+36]) + Pexp_ident "blah" (test/basicStructures.t/input.re[81,1401+32]..[81,1401+36]) + ] + ] + structure_item (test/basicStructures.t/input.re[83,1449+0]..[83,1449+46]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[83,1449+4]..[83,1449+28]) + Ppat_var "parensNeededAroundSecond" (test/basicStructures.t/input.re[83,1449+4]..[83,1449+28]) + expression (test/basicStructures.t/input.re[83,1449+31]..[83,1449+46]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[83,1449+31]..[83,1449+42]) + Pexp_apply + expression (test/basicStructures.t/input.re[83,1449+32]..[83,1449+33]) + Pexp_ident "not" (test/basicStructures.t/input.re[83,1449+32]..[83,1449+33]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[83,1449+33]..[83,1449+41]) + Pexp_send "foo" + expression (test/basicStructures.t/input.re[83,1449+33]..[83,1449+37]) + Pexp_ident "blah" (test/basicStructures.t/input.re[83,1449+33]..[83,1449+37]) + ] + ] + structure_item (test/basicStructures.t/input.re[86,1499+0]..[86,1499+56]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[86,1499+4]..[86,1499+36]) + Ppat_var "parensWithSpaceNeededAroundFirst" (test/basicStructures.t/input.re[86,1499+4]..[86,1499+36]) + expression (test/basicStructures.t/input.re[86,1499+39]..[86,1499+56]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[86,1499+39]..[86,1499+52]) + Pexp_send "foo" + expression (test/basicStructures.t/input.re[86,1499+39]..[86,1499+48]) + Pexp_apply + expression (test/basicStructures.t/input.re[86,1499+40]..[86,1499+41]) + Pexp_ident "not" (test/basicStructures.t/input.re[86,1499+40]..[86,1499+41]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[86,1499+42]..[86,1499+47]) + Pexp_apply + expression (test/basicStructures.t/input.re[86,1499+42]..[86,1499+43]) + Pexp_ident "not" (test/basicStructures.t/input.re[86,1499+42]..[86,1499+43]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[86,1499+43]..[86,1499+47]) + Pexp_ident "blah" (test/basicStructures.t/input.re[86,1499+43]..[86,1499+47]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[88,1558+0]..[88,1558+57]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[88,1558+4]..[88,1558+37]) + Ppat_var "parensWithSpaceNeededAroundSecond" (test/basicStructures.t/input.re[88,1558+4]..[88,1558+37]) + expression (test/basicStructures.t/input.re[88,1558+40]..[88,1558+57]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[88,1558+40]..[88,1558+53]) + Pexp_apply + expression (test/basicStructures.t/input.re[88,1558+41]..[88,1558+42]) + Pexp_ident "not" (test/basicStructures.t/input.re[88,1558+41]..[88,1558+42]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[88,1558+43]..[88,1558+52]) + Pexp_apply + expression (test/basicStructures.t/input.re[88,1558+43]..[88,1558+44]) + Pexp_ident "not" (test/basicStructures.t/input.re[88,1558+43]..[88,1558+44]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[88,1558+44]..[88,1558+52]) + Pexp_send "foo" + expression (test/basicStructures.t/input.re[88,1558+44]..[88,1558+48]) + Pexp_ident "blah" (test/basicStructures.t/input.re[88,1558+44]..[88,1558+48]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[90,1618+0]..[90,1618+58]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[90,1618+4]..[90,1618+36]) + Ppat_var "parensWithSpaceNeededAroundFirst" (test/basicStructures.t/input.re[90,1618+4]..[90,1618+36]) + expression (test/basicStructures.t/input.re[90,1618+39]..[90,1618+58]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[90,1618+39]..[90,1618+54]) + Pexp_send "foo" + expression (test/basicStructures.t/input.re[90,1618+39]..[90,1618+50]) + Pexp_apply + expression (test/basicStructures.t/input.re[90,1618+40]..[90,1618+42]) + Pexp_ident "?!" (test/basicStructures.t/input.re[90,1618+40]..[90,1618+42]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[90,1618+43]..[90,1618+49]) + Pexp_apply + expression (test/basicStructures.t/input.re[90,1618+43]..[90,1618+45]) + Pexp_ident "~+" (test/basicStructures.t/input.re[90,1618+43]..[90,1618+45]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[90,1618+45]..[90,1618+49]) + Pexp_ident "blah" (test/basicStructures.t/input.re[90,1618+45]..[90,1618+49]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[92,1679+0]..[92,1679+59]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[92,1679+4]..[92,1679+37]) + Ppat_var "parensWithSpaceNeededAroundSecond" (test/basicStructures.t/input.re[92,1679+4]..[92,1679+37]) + expression (test/basicStructures.t/input.re[92,1679+40]..[92,1679+59]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[92,1679+40]..[92,1679+55]) + Pexp_apply + expression (test/basicStructures.t/input.re[92,1679+41]..[92,1679+43]) + Pexp_ident "?!" (test/basicStructures.t/input.re[92,1679+41]..[92,1679+43]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[92,1679+44]..[92,1679+54]) + Pexp_apply + expression (test/basicStructures.t/input.re[92,1679+44]..[92,1679+46]) + Pexp_ident "~+" (test/basicStructures.t/input.re[92,1679+44]..[92,1679+46]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[92,1679+46]..[92,1679+54]) + Pexp_send "foo" + expression (test/basicStructures.t/input.re[92,1679+46]..[92,1679+50]) + Pexp_ident "blah" (test/basicStructures.t/input.re[92,1679+46]..[92,1679+50]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[94,1741+0]..[94,1741+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[94,1741+4]..[94,1741+5]) + Ppat_var "x" (test/basicStructures.t/input.re[94,1741+4]..[94,1741+5]) + expression (test/basicStructures.t/input.re[94,1741+8]..[94,1741+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[94,1741+8]..[94,1741+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[94,1741+8]..[94,1741+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[94,1741+9]..[94,1741+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[94,1741+10]..[94,1741+11]) + Pexp_ident "not" (test/basicStructures.t/input.re[94,1741+10]..[94,1741+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[94,1741+11]..[94,1741+18]) + Pexp_field + expression (test/basicStructures.t/input.re[94,1741+11]..[94,1741+14]) + Pexp_ident "foo" (test/basicStructures.t/input.re[94,1741+11]..[94,1741+14]) + "bar" (test/basicStructures.t/input.re[94,1741+15]..[94,1741+18]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[96,1763+0]..[96,1763+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[96,1763+4]..[96,1763+5]) + Ppat_var "x" (test/basicStructures.t/input.re[96,1763+4]..[96,1763+5]) + expression (test/basicStructures.t/input.re[96,1763+8]..[96,1763+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[96,1763+8]..[96,1763+9]) + Pexp_ident "not" (test/basicStructures.t/input.re[96,1763+8]..[96,1763+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[96,1763+9]..[96,1763+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[96,1763+10]..[96,1763+11]) + Pexp_ident "not" (test/basicStructures.t/input.re[96,1763+10]..[96,1763+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[96,1763+11]..[96,1763+18]) + Pexp_send "bar" + expression (test/basicStructures.t/input.re[96,1763+11]..[96,1763+14]) + Pexp_ident "foo" (test/basicStructures.t/input.re[96,1763+11]..[96,1763+14]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[98,1785+0]..[98,1785+11]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[98,1785+4]..[98,1785+5]) + Ppat_var "x" (test/basicStructures.t/input.re[98,1785+4]..[98,1785+5]) + expression (test/basicStructures.t/input.re[98,1785+8]..[98,1785+11]) + Pexp_constant PConst_int (-10,None) + ] + structure_item (test/basicStructures.t/input.re[100,1799+0]..[100,1799+12]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[100,1799+4]..[100,1799+5]) + Ppat_var "x" (test/basicStructures.t/input.re[100,1799+4]..[100,1799+5]) + expression (test/basicStructures.t/input.re[100,1799+8]..[100,1799+12]) + Pexp_constant PConst_float (-5.0,None) + ] + structure_item (test/basicStructures.t/input.re[102,1814+0]..[102,1814+17]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[102,1814+4]..[102,1814+5]) + Ppat_var "x" (test/basicStructures.t/input.re[102,1814+4]..[102,1814+5]) + expression (test/basicStructures.t/input.re[102,1814+8]..[102,1814+17]) + attribute "explicit_arity" + [] + Pexp_construct "Some" (test/basicStructures.t/input.re[102,1814+8]..[102,1814+12]) + Some + expression (test/basicStructures.t/input.re[102,1814+12]..[102,1814+17]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[102,1814+13]..[102,1814+16]) + Pexp_constant PConst_int (-10,None) + ] + ] + structure_item (test/basicStructures.t/input.re[104,1834+0]..[104,1834+18]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[104,1834+4]..[104,1834+5]) + Ppat_var "x" (test/basicStructures.t/input.re[104,1834+4]..[104,1834+5]) + expression (test/basicStructures.t/input.re[104,1834+8]..[104,1834+18]) + attribute "explicit_arity" + [] + Pexp_construct "Some" (test/basicStructures.t/input.re[104,1834+8]..[104,1834+12]) + Some + expression (test/basicStructures.t/input.re[104,1834+12]..[104,1834+18]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[104,1834+13]..[104,1834+17]) + Pexp_constant PConst_float (-5.0,None) + ] + ] + structure_item (test/basicStructures.t/input.re[106,1855+0]..[106,1855+15]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[106,1855+4]..[106,1855+10]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[106,1855+9]..[106,1855+10]) + Ppat_var "x" (test/basicStructures.t/input.re[106,1855+9]..[106,1855+10]) + expression (test/basicStructures.t/input.re[106,1855+13]..[106,1855+15]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[107,1872+0]..[107,1872+23]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[107,1872+4]..[107,1872+18]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[107,1872+9]..[107,1872+18]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[107,1872+10]..[107,1872+11]) + Ppat_var "x" (test/basicStructures.t/input.re[107,1872+10]..[107,1872+11]) + core_type (test/basicStructures.t/input.re[107,1872+14]..[107,1872+17]) + Ptyp_constr "int" (test/basicStructures.t/input.re[107,1872+14]..[107,1872+17]) + [] + expression (test/basicStructures.t/input.re[107,1872+21]..[107,1872+23]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[108,1897+0]..[108,1897+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[108,1897+4]..[108,1897+11]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[108,1897+9]..[108,1897+11]) + Ppat_construct "[]" (test/basicStructures.t/input.re[108,1897+9]..[108,1897+11]) + None + expression (test/basicStructures.t/input.re[108,1897+14]..[108,1897+16]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[109,1915+0]..[109,1915+18]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[109,1915+4]..[109,1915+13]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[109,1915+9]..[109,1915+13]) + Ppat_construct "true" (test/basicStructures.t/input.re[109,1915+9]..[109,1915+13]) + None + expression (test/basicStructures.t/input.re[109,1915+16]..[109,1915+18]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[110,1935+0]..[110,1935+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[110,1935+4]..[110,1935+11]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[110,1935+9]..[110,1935+11]) + Ppat_type + "x" (test/basicStructures.t/input.re[110,1935+10]..[110,1935+11]) + expression (test/basicStructures.t/input.re[110,1935+14]..[110,1935+16]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[111,1953+0]..[111,1953+22]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[111,1953+4]..[111,1953+17]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[111,1953+9]..[111,1953+17]) + Ppat_variant "Variant" + None + expression (test/basicStructures.t/input.re[111,1953+20]..[111,1953+22]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[112,1977+0]..[112,1977+22]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[112,1977+4]..[112,1977+17]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[112,1977+9]..[112,1977+17]) + Ppat_variant "variant" + None + expression (test/basicStructures.t/input.re[112,1977+20]..[112,1977+22]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[113,2001+0]..[113,2001+26]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[113,2001+4]..[113,2001+21]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[113,2001+9]..[113,2001+21]) + Ppat_interval PConst_char 30..PConst_char 39 + expression (test/basicStructures.t/input.re[113,2001+24]..[113,2001+26]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[114,2029+0]..[114,2029+25]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[114,2029+4]..[114,2029+20]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[114,2029+9]..[114,2029+20]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[114,2029+15]..[114,2029+19]) + Ppat_construct "true" (test/basicStructures.t/input.re[114,2029+15]..[114,2029+19]) + None + expression (test/basicStructures.t/input.re[114,2029+23]..[114,2029+25]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[115,2056+0]..[115,2056+23]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[115,2056+4]..[115,2056+18]) + Ppat_lazy + pattern (test/basicStructures.t/input.re[115,2056+9]..[115,2056+18]) + Ppat_extension "extend" + [] + expression (test/basicStructures.t/input.re[115,2056+21]..[115,2056+23]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[118,2120+0]..[118,2120+15]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[118,2120+4]..[118,2120+5]) + Ppat_var "x" (test/basicStructures.t/input.re[118,2120+4]..[118,2120+5]) + expression (test/basicStructures.t/input.re[118,2120+8]..[118,2120+15]) + Pexp_apply + expression (test/basicStructures.t/input.re[118,2120+8]..[118,2120+15]) ghost + Pexp_ident "Array.get" (test/basicStructures.t/input.re[118,2120+8]..[118,2120+15]) ghost + [ + + Nolabel + expression (test/basicStructures.t/input.re[118,2120+8]..[118,2120+12]) + Pexp_apply + expression (test/basicStructures.t/input.re[118,2120+11]..[118,2120+12]) + Pexp_ident "!" (test/basicStructures.t/input.re[118,2120+11]..[118,2120+12]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[118,2120+8]..[118,2120+11]) + Pexp_ident "arr" (test/basicStructures.t/input.re[118,2120+8]..[118,2120+11]) + ] + + Nolabel + expression (test/basicStructures.t/input.re[118,2120+13]..[118,2120+14]) + Pexp_constant PConst_int (0,None) + ] + ] + structure_item (test/basicStructures.t/input.re[120,2138+0]..[120,2138+25]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[120,2138+4]..[120,2138+5]) + Ppat_var "x" (test/basicStructures.t/input.re[120,2138+4]..[120,2138+5]) + expression (test/basicStructures.t/input.re[120,2138+8]..[120,2138+25]) + Pexp_apply + expression (test/basicStructures.t/input.re[120,2138+8]..[120,2138+17]) + Pexp_ident "Array.get" (test/basicStructures.t/input.re[120,2138+8]..[120,2138+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[120,2138+18]..[120,2138+22]) + Pexp_apply + expression (test/basicStructures.t/input.re[120,2138+21]..[120,2138+22]) + Pexp_ident "!" (test/basicStructures.t/input.re[120,2138+21]..[120,2138+22]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[120,2138+18]..[120,2138+21]) + Pexp_ident "arr" (test/basicStructures.t/input.re[120,2138+18]..[120,2138+21]) + ] + + Nolabel + expression (test/basicStructures.t/input.re[120,2138+23]..[120,2138+24]) + Pexp_constant PConst_int (0,None) + ] + ] + structure_item (test/basicStructures.t/input.re[122,2166+0]..[122,2166+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[122,2166+4]..[122,2166+5]) + Ppat_var "x" (test/basicStructures.t/input.re[122,2166+4]..[122,2166+5]) + expression (test/basicStructures.t/input.re[122,2166+8]..[122,2166+16]) + Pexp_apply + expression (test/basicStructures.t/input.re[122,2166+8]..[122,2166+16]) ghost + Pexp_ident "String.get" (test/basicStructures.t/input.re[122,2166+8]..[122,2166+16]) ghost + [ + + Nolabel + expression (test/basicStructures.t/input.re[122,2166+8]..[122,2166+12]) + Pexp_apply + expression (test/basicStructures.t/input.re[122,2166+11]..[122,2166+12]) + Pexp_ident "!" (test/basicStructures.t/input.re[122,2166+11]..[122,2166+12]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[122,2166+8]..[122,2166+11]) + Pexp_ident "str" (test/basicStructures.t/input.re[122,2166+8]..[122,2166+11]) + ] + + Nolabel + expression (test/basicStructures.t/input.re[122,2166+14]..[122,2166+15]) + Pexp_constant PConst_int (0,None) + ] + ] + structure_item (test/basicStructures.t/input.re[124,2185+0]..[124,2185+26]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[124,2185+4]..[124,2185+5]) + Ppat_var "x" (test/basicStructures.t/input.re[124,2185+4]..[124,2185+5]) + expression (test/basicStructures.t/input.re[124,2185+8]..[124,2185+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[124,2185+8]..[124,2185+18]) + Pexp_ident "String.get" (test/basicStructures.t/input.re[124,2185+8]..[124,2185+18]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[124,2185+19]..[124,2185+23]) + Pexp_apply + expression (test/basicStructures.t/input.re[124,2185+22]..[124,2185+23]) + Pexp_ident "!" (test/basicStructures.t/input.re[124,2185+22]..[124,2185+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[124,2185+19]..[124,2185+22]) + Pexp_ident "str" (test/basicStructures.t/input.re[124,2185+19]..[124,2185+22]) + ] + + Nolabel + expression (test/basicStructures.t/input.re[124,2185+24]..[124,2185+25]) + Pexp_constant PConst_int (0,None) + ] + ] + structure_item (test/basicStructures.t/input.re[126,2214+0]..[126,2214+27]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[126,2214+4]..[126,2214+5]) + Ppat_var "x" (test/basicStructures.t/input.re[126,2214+4]..[126,2214+5]) + expression (test/basicStructures.t/input.re[126,2214+8]..[126,2214+27]) + Pexp_apply + expression (test/basicStructures.t/input.re[126,2214+8]..[126,2214+17]) + Pexp_ident "Array.set" (test/basicStructures.t/input.re[126,2214+8]..[126,2214+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[126,2214+18]..[126,2214+22]) + Pexp_apply + expression (test/basicStructures.t/input.re[126,2214+21]..[126,2214+22]) + Pexp_ident "!" (test/basicStructures.t/input.re[126,2214+21]..[126,2214+22]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[126,2214+18]..[126,2214+21]) + Pexp_ident "arr" (test/basicStructures.t/input.re[126,2214+18]..[126,2214+21]) + ] + + Nolabel + expression (test/basicStructures.t/input.re[126,2214+23]..[126,2214+24]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[126,2214+25]..[126,2214+26]) + Pexp_constant PConst_int (1,None) + ] + ] + structure_item (test/basicStructures.t/input.re[128,2244+0]..[128,2244+19]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[128,2244+4]..[128,2244+5]) + Ppat_var "x" (test/basicStructures.t/input.re[128,2244+4]..[128,2244+5]) + expression (test/basicStructures.t/input.re[128,2244+8]..[128,2244+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[128,2244+8]..[128,2244+19]) ghost + Pexp_ident "Array.set" (test/basicStructures.t/input.re[128,2244+8]..[128,2244+19]) ghost + [ + + Nolabel + expression (test/basicStructures.t/input.re[128,2244+8]..[128,2244+12]) + Pexp_apply + expression (test/basicStructures.t/input.re[128,2244+11]..[128,2244+12]) + Pexp_ident "!" (test/basicStructures.t/input.re[128,2244+11]..[128,2244+12]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[128,2244+8]..[128,2244+11]) + Pexp_ident "arr" (test/basicStructures.t/input.re[128,2244+8]..[128,2244+11]) + ] + + Nolabel + expression (test/basicStructures.t/input.re[128,2244+13]..[128,2244+14]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[128,2244+18]..[128,2244+19]) + Pexp_constant PConst_int (1,None) + ] + ] + structure_item (test/basicStructures.t/input.re[132,2311+0]..[132,2311+4]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[132,2311+0]..[132,2311+4]) + Pstr_eval + expression (test/basicStructures.t/input.re[132,2311+0]..[132,2311+4]) + Pexp_constant PConst_string("",(test/basicStructures.t/input.re[132,2311+0]..[132,2311+4]),None) + ] + structure_item (test/basicStructures.t/input.re[133,2316+0]..[135,2429+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[133,2316+0]..[135,2429+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[133,2316+0]..[135,2429+3]) + Pexp_constant PConst_string(" IF\n *============================================================================\n ",(test/basicStructures.t/input.re[133,2316+0]..[135,2429+3]),None) + ] + structure_item (test/basicStructures.t/input.re[137,2435+0]..[137,2435+15]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[137,2435+4]..[137,2435+9]) + Ppat_var "/++" (test/basicStructures.t/input.re[137,2435+4]..[137,2435+9]) + expression (test/basicStructures.t/input.re[137,2435+12]..[137,2435+15]) + Pexp_ident "+" (test/basicStructures.t/input.re[137,2435+12]..[137,2435+15]) + ] + structure_item (test/basicStructures.t/input.re[139,2512+0]..[142,2654+27]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[139,2512+4]..[139,2512+13]) + Ppat_var "something" (test/basicStructures.t/input.re[139,2512+4]..[139,2512+13]) + expression (test/basicStructures.t/input.re[139,2512+16]..[142,2654+27]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[139,2512+19]..[139,2512+40]) + Pexp_field + expression (test/basicStructures.t/input.re[139,2512+20]..[139,2512+28]) + Pexp_field + expression (test/basicStructures.t/input.re[139,2512+20]..[139,2512+24]) + Pexp_ident "self" (test/basicStructures.t/input.re[139,2512+20]..[139,2512+24]) + "ext" (test/basicStructures.t/input.re[139,2512+25]..[139,2512+28]) + "logSuccess" (test/basicStructures.t/input.re[139,2512+29]..[139,2512+39]) + expression (test/basicStructures.t/input.re[139,2512+41]..[142,2654+27]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[140,2555+28]..[140,2555+51]) + Pexp_apply + expression (test/basicStructures.t/input.re[140,2555+28]..[140,2555+40]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[140,2555+28]..[140,2555+40]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[140,2555+41]..[140,2555+50]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Did tap",(test/basicStructures.t/input.re[140,2555+41]..[140,2555+50]),None) + ] + Pexp_constant PConst_string("Did tap",(test/basicStructures.t/input.re[140,2555+41]..[140,2555+50]),None) + ] + expression (test/basicStructures.t/input.re[141,2608+28]..[141,2608+45]) + Pexp_apply + expression (test/basicStructures.t/input.re[141,2608+28]..[141,2608+41]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[141,2608+28]..[141,2608+41]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[141,2608+42]..[141,2608+44]) + Pexp_construct "()" (test/basicStructures.t/input.re[141,2608+42]..[141,2608+44]) + None + ] + None + ] + structure_item (test/basicStructures.t/input.re[144,2684+0]..[149,2910+27]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[144,2684+4]..[144,2684+17]) + Ppat_var "logTapSuccess" (test/basicStructures.t/input.re[144,2684+4]..[144,2684+17]) + expression (test/basicStructures.t/input.re[144,2684+20]..[149,2910+27]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[144,2684+24]..[144,2684+28]) + Ppat_var "self" (test/basicStructures.t/input.re[144,2684+24]..[144,2684+28]) + expression (test/basicStructures.t/input.re[144,2684+33]..[149,2910+27]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[144,2684+36]..[144,2684+57]) + Pexp_field + expression (test/basicStructures.t/input.re[144,2684+37]..[144,2684+45]) + Pexp_field + expression (test/basicStructures.t/input.re[144,2684+37]..[144,2684+41]) + Pexp_ident "self" (test/basicStructures.t/input.re[144,2684+37]..[144,2684+41]) + "ext" (test/basicStructures.t/input.re[144,2684+42]..[144,2684+45]) + "logSuccess" (test/basicStructures.t/input.re[144,2684+46]..[144,2684+56]) + expression (test/basicStructures.t/input.re[144,2684+58]..[147,2843+27]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[145,2744+28]..[145,2744+51]) + Pexp_apply + expression (test/basicStructures.t/input.re[145,2744+28]..[145,2744+40]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[145,2744+28]..[145,2744+40]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[145,2744+41]..[145,2744+50]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Did tap",(test/basicStructures.t/input.re[145,2744+41]..[145,2744+50]),None) + ] + Pexp_constant PConst_string("Did tap",(test/basicStructures.t/input.re[145,2744+41]..[145,2744+50]),None) + ] + expression (test/basicStructures.t/input.re[146,2797+28]..[146,2797+45]) + Pexp_apply + expression (test/basicStructures.t/input.re[146,2797+28]..[146,2797+41]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[146,2797+28]..[146,2797+41]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[146,2797+42]..[146,2797+44]) + Pexp_construct "()" (test/basicStructures.t/input.re[146,2797+42]..[146,2797+44]) + None + ] + Some + expression (test/basicStructures.t/input.re[147,2843+33]..[149,2910+27]) + attribute "reason.preserve_braces" + [] + Pexp_construct "()" (test/basicStructures.t/input.re[148,2878+28]..[148,2878+30]) + None + ] + structure_item (test/basicStructures.t/input.re[151,2940+0]..[154,3092+27]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[151,2940+4]..[151,2940+17]) + Ppat_var "logTapSuccess" (test/basicStructures.t/input.re[151,2940+4]..[151,2940+17]) + expression (test/basicStructures.t/input.re[151,2940+18]..[154,3092+27]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[151,2940+18]..[151,2940+22]) + Ppat_var "self" (test/basicStructures.t/input.re[151,2940+18]..[151,2940+22]) + expression (test/basicStructures.t/input.re[151,2940+26]..[154,3092+27]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[151,2940+29]..[151,2940+50]) + Pexp_field + expression (test/basicStructures.t/input.re[151,2940+30]..[151,2940+38]) + Pexp_field + expression (test/basicStructures.t/input.re[151,2940+30]..[151,2940+34]) + Pexp_ident "self" (test/basicStructures.t/input.re[151,2940+30]..[151,2940+34]) + "ext" (test/basicStructures.t/input.re[151,2940+35]..[151,2940+38]) + "logSuccess" (test/basicStructures.t/input.re[151,2940+39]..[151,2940+49]) + expression (test/basicStructures.t/input.re[151,2940+51]..[154,3092+27]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[152,2993+28]..[152,2993+51]) + Pexp_apply + expression (test/basicStructures.t/input.re[152,2993+28]..[152,2993+40]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[152,2993+28]..[152,2993+40]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[152,2993+41]..[152,2993+50]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Did tap",(test/basicStructures.t/input.re[152,2993+41]..[152,2993+50]),None) + ] + Pexp_constant PConst_string("Did tap",(test/basicStructures.t/input.re[152,2993+41]..[152,2993+50]),None) + ] + expression (test/basicStructures.t/input.re[153,3046+28]..[153,3046+45]) + Pexp_apply + expression (test/basicStructures.t/input.re[153,3046+28]..[153,3046+41]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[153,3046+28]..[153,3046+41]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[153,3046+42]..[153,3046+44]) + Pexp_construct "()" (test/basicStructures.t/input.re[153,3046+42]..[153,3046+44]) + None + ] + None + ] + structure_item (test/basicStructures.t/input.re[156,3122+0]..[156,3122+20]) + Pstr_eval + expression (test/basicStructures.t/input.re[156,3122+0]..[156,3122+20]) + Pexp_setfield + expression (test/basicStructures.t/input.re[156,3122+0]..[156,3122+7]) + Pexp_apply + expression (test/basicStructures.t/input.re[156,3122+1]..[156,3122+2]) + Pexp_ident "not" (test/basicStructures.t/input.re[156,3122+1]..[156,3122+2]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[156,3122+2]..[156,3122+6]) + Pexp_ident "data" (test/basicStructures.t/input.re[156,3122+2]..[156,3122+6]) + ] + "field" (test/basicStructures.t/input.re[156,3122+8]..[156,3122+13]) + expression (test/basicStructures.t/input.re[156,3122+16]..[156,3122+20]) + Pexp_construct "true" (test/basicStructures.t/input.re[156,3122+16]..[156,3122+20]) + None + structure_item (test/basicStructures.t/input.re[157,3144+0]..[157,3144+28]) + Pstr_eval + expression (test/basicStructures.t/input.re[157,3144+0]..[157,3144+28]) + Pexp_setfield + expression (test/basicStructures.t/input.re[157,3144+0]..[157,3144+14]) + Pexp_field + expression (test/basicStructures.t/input.re[157,3144+0]..[157,3144+7]) + Pexp_apply + expression (test/basicStructures.t/input.re[157,3144+1]..[157,3144+2]) + Pexp_ident "not" (test/basicStructures.t/input.re[157,3144+1]..[157,3144+2]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[157,3144+2]..[157,3144+6]) + Pexp_ident "data" (test/basicStructures.t/input.re[157,3144+2]..[157,3144+6]) + ] + "field1" (test/basicStructures.t/input.re[157,3144+8]..[157,3144+14]) + "field2" (test/basicStructures.t/input.re[157,3144+15]..[157,3144+21]) + expression (test/basicStructures.t/input.re[157,3144+24]..[157,3144+28]) + Pexp_construct "true" (test/basicStructures.t/input.re[157,3144+24]..[157,3144+28]) + None + structure_item (test/basicStructures.t/input.re[158,3174+0]..[158,3174+28]) + Pstr_eval + expression (test/basicStructures.t/input.re[158,3174+0]..[158,3174+28]) + Pexp_setfield + expression (test/basicStructures.t/input.re[158,3174+0]..[158,3174+14]) + Pexp_apply + expression (test/basicStructures.t/input.re[158,3174+1]..[158,3174+2]) + Pexp_ident "not" (test/basicStructures.t/input.re[158,3174+1]..[158,3174+2]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[158,3174+2]..[158,3174+13]) + Pexp_field + expression (test/basicStructures.t/input.re[158,3174+2]..[158,3174+6]) + Pexp_ident "data" (test/basicStructures.t/input.re[158,3174+2]..[158,3174+6]) + "field1" (test/basicStructures.t/input.re[158,3174+7]..[158,3174+13]) + ] + "field2" (test/basicStructures.t/input.re[158,3174+15]..[158,3174+21]) + expression (test/basicStructures.t/input.re[158,3174+24]..[158,3174+28]) + Pexp_construct "true" (test/basicStructures.t/input.re[158,3174+24]..[158,3174+28]) + None + structure_item (test/basicStructures.t/input.re[159,3204+0]..[159,3204+30]) + Pstr_eval + expression (test/basicStructures.t/input.re[159,3204+0]..[159,3204+30]) + Pexp_setfield + expression (test/basicStructures.t/input.re[159,3204+0]..[159,3204+16]) + Pexp_field + expression (test/basicStructures.t/input.re[159,3204+1]..[159,3204+8]) + Pexp_apply + expression (test/basicStructures.t/input.re[159,3204+2]..[159,3204+3]) + Pexp_ident "not" (test/basicStructures.t/input.re[159,3204+2]..[159,3204+3]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[159,3204+3]..[159,3204+7]) + Pexp_ident "data" (test/basicStructures.t/input.re[159,3204+3]..[159,3204+7]) + ] + "field1" (test/basicStructures.t/input.re[159,3204+9]..[159,3204+15]) + "field2" (test/basicStructures.t/input.re[159,3204+17]..[159,3204+23]) + expression (test/basicStructures.t/input.re[159,3204+26]..[159,3204+30]) + Pexp_construct "true" (test/basicStructures.t/input.re[159,3204+26]..[159,3204+30]) + None + structure_item (test/basicStructures.t/input.re[160,3236+0]..[160,3236+30]) + Pstr_eval + expression (test/basicStructures.t/input.re[160,3236+0]..[160,3236+30]) + Pexp_setfield + expression (test/basicStructures.t/input.re[160,3236+0]..[160,3236+16]) + Pexp_apply + expression (test/basicStructures.t/input.re[160,3236+1]..[160,3236+2]) + Pexp_ident "not" (test/basicStructures.t/input.re[160,3236+1]..[160,3236+2]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[160,3236+2]..[160,3236+15]) + Pexp_field + expression (test/basicStructures.t/input.re[160,3236+3]..[160,3236+7]) + Pexp_ident "data" (test/basicStructures.t/input.re[160,3236+3]..[160,3236+7]) + "field1" (test/basicStructures.t/input.re[160,3236+8]..[160,3236+14]) + ] + "field2" (test/basicStructures.t/input.re[160,3236+17]..[160,3236+23]) + expression (test/basicStructures.t/input.re[160,3236+26]..[160,3236+30]) + Pexp_construct "true" (test/basicStructures.t/input.re[160,3236+26]..[160,3236+30]) + None + structure_item (test/basicStructures.t/input.re[162,3269+0]..[169,3434+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[162,3269+4]..[162,3269+8]) + Ppat_var "loop" (test/basicStructures.t/input.re[162,3269+4]..[162,3269+8]) + expression (test/basicStructures.t/input.re[162,3269+9]..[169,3434+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[162,3269+9]..[162,3269+16]) + Ppat_var "appTime" (test/basicStructures.t/input.re[162,3269+9]..[162,3269+16]) + expression (test/basicStructures.t/input.re[162,3269+17]..[169,3434+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[162,3269+17]..[162,3269+26]) + Ppat_var "frameTime" (test/basicStructures.t/input.re[162,3269+17]..[162,3269+26]) + expression (test/basicStructures.t/input.re[162,3269+30]..[169,3434+1]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[163,3301+2]..[167,3399+3]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[163,3301+5]..[163,3301+24]) + Pexp_field + expression (test/basicStructures.t/input.re[163,3301+6]..[163,3301+14]) + Pexp_ident "hasSetup" (test/basicStructures.t/input.re[163,3301+6]..[163,3301+14]) + "contents" (test/basicStructures.t/input.re[163,3301+15]..[163,3301+23]) + expression (test/basicStructures.t/input.re[163,3301+25]..[167,3399+3]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[164,3328+4]..[164,3328+17]) + Pexp_apply + expression (test/basicStructures.t/input.re[164,3328+4]..[164,3328+14]) + Pexp_ident "setupScene" (test/basicStructures.t/input.re[164,3328+4]..[164,3328+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[164,3328+15]..[164,3328+17]) + Pexp_construct "()" (test/basicStructures.t/input.re[164,3328+15]..[164,3328+17]) + None + ] + expression (test/basicStructures.t/input.re[165,3347+4]..[166,3369+29]) + Pexp_sequence + expression (test/basicStructures.t/input.re[165,3347+4]..[165,3347+20]) + Pexp_apply + expression (test/basicStructures.t/input.re[165,3347+4]..[165,3347+17]) + Pexp_ident "renderIntoTop" (test/basicStructures.t/input.re[165,3347+4]..[165,3347+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[165,3347+18]..[165,3347+20]) + Pexp_construct "()" (test/basicStructures.t/input.re[165,3347+18]..[165,3347+20]) + None + ] + expression (test/basicStructures.t/input.re[166,3369+4]..[166,3369+29]) + Pexp_setfield + expression (test/basicStructures.t/input.re[166,3369+4]..[166,3369+12]) + Pexp_ident "hasSetup" (test/basicStructures.t/input.re[166,3369+4]..[166,3369+12]) + "contents" (test/basicStructures.t/input.re[166,3369+13]..[166,3369+21]) + expression (test/basicStructures.t/input.re[166,3369+24]..[166,3369+28]) + Pexp_construct "true" (test/basicStructures.t/input.re[166,3369+24]..[166,3369+28]) + None + None + expression (test/basicStructures.t/input.re[168,3404+2]..[168,3404+29]) + Pexp_apply + expression (test/basicStructures.t/input.re[168,3404+2]..[168,3404+9]) + Pexp_ident "process" (test/basicStructures.t/input.re[168,3404+2]..[168,3404+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[168,3404+10]..[168,3404+17]) + Pexp_ident "appTime" (test/basicStructures.t/input.re[168,3404+10]..[168,3404+17]) + + Nolabel + expression (test/basicStructures.t/input.re[168,3404+18]..[168,3404+27]) + Pexp_ident "frameTime" (test/basicStructures.t/input.re[168,3404+18]..[168,3404+27]) + ] + ] + structure_item (test/basicStructures.t/input.re[172,3508+0]..[178,3584+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[172,3508+0]..[178,3584+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[172,3508+3]..[172,3508+14]) + Pexp_ident "something" (test/basicStructures.t/input.re[172,3508+4]..[172,3508+13]) + expression (test/basicStructures.t/input.re[172,3508+15]..[178,3584+1]) + attribute "reason.preserve_braces" + [] + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[173,3525+5]..[173,3525+20]) + Pexp_ident "somethingElse" (test/basicStructures.t/input.re[173,3525+6]..[173,3525+19]) + expression (test/basicStructures.t/input.re[173,3525+21]..[175,3556+3]) + attribute "reason.preserve_braces" + [] + Pexp_construct "()" (test/basicStructures.t/input.re[174,3548+4]..[174,3548+6]) + None + Some + expression (test/basicStructures.t/input.re[175,3556+9]..[177,3579+3]) + attribute "reason.preserve_braces" + [] + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("blah",(test/basicStructures.t/input.re[176,3567+4]..[176,3567+10]),None) + ] + Pexp_constant PConst_string("blah",(test/basicStructures.t/input.re[176,3567+4]..[176,3567+10]),None) + None + structure_item (test/basicStructures.t/input.re[181,3650+0]..[181,3650+57]) + Pstr_eval + expression (test/basicStructures.t/input.re[181,3650+0]..[181,3650+57]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[181,3650+3]..[181,3650+14]) + Pexp_ident "something" (test/basicStructures.t/input.re[181,3650+4]..[181,3650+13]) + expression (test/basicStructures.t/input.re[181,3650+15]..[181,3650+57]) + attribute "reason.preserve_braces" + [] + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[181,3650+19]..[181,3650+34]) + Pexp_ident "somethingElse" (test/basicStructures.t/input.re[181,3650+20]..[181,3650+33]) + expression (test/basicStructures.t/input.re[181,3650+35]..[181,3650+40]) + attribute "reason.preserve_braces" + [] + Pexp_construct "()" (test/basicStructures.t/input.re[181,3650+36]..[181,3650+38]) + None + Some + expression (test/basicStructures.t/input.re[181,3650+46]..[181,3650+55]) + attribute "reason.preserve_braces" + [] + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("blah",(test/basicStructures.t/input.re[181,3650+47]..[181,3650+53]),None) + ] + Pexp_constant PConst_string("blah",(test/basicStructures.t/input.re[181,3650+47]..[181,3650+53]),None) + None + structure_item (test/basicStructures.t/input.re[185,3847+0]..[191,3939+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[185,3847+0]..[191,3939+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[185,3847+3]..[185,3847+9]) + Pexp_construct "true" (test/basicStructures.t/input.re[185,3847+4]..[185,3847+8]) + None + expression (test/basicStructures.t/input.re[185,3847+10]..[191,3939+1]) + attribute "reason.preserve_braces" + [] + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[186,3859+5]..[186,3859+11]) + Pexp_construct "true" (test/basicStructures.t/input.re[186,3859+6]..[186,3859+10]) + None + expression (test/basicStructures.t/input.re[186,3859+12]..[188,3898+3]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[187,3873+4]..[187,3873+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[187,3873+4]..[187,3873+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[187,3873+17]..[187,3873+22]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("one",(test/basicStructures.t/input.re[187,3873+17]..[187,3873+22]),None) + ] + Pexp_constant PConst_string("one",(test/basicStructures.t/input.re[187,3873+17]..[187,3873+22]),None) + ] + Some + expression (test/basicStructures.t/input.re[188,3898+9]..[190,3934+3]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[189,3909+4]..[189,3909+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[189,3909+4]..[189,3909+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[189,3909+17]..[189,3909+22]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("two",(test/basicStructures.t/input.re[189,3909+17]..[189,3909+22]),None) + ] + Pexp_constant PConst_string("two",(test/basicStructures.t/input.re[189,3909+17]..[189,3909+22]),None) + ] + None + structure_item (test/basicStructures.t/input.re[194,3966+0]..[200,4059+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[194,3966+0]..[200,4059+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[194,3966+3]..[194,3966+9]) + Pexp_construct "true" (test/basicStructures.t/input.re[194,3966+4]..[194,3966+8]) + None + expression (test/basicStructures.t/input.re[194,3966+10]..[200,4059+1]) + attribute "reason.preserve_braces" + [] + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[195,3978+5]..[195,3978+12]) + Pexp_construct "false" (test/basicStructures.t/input.re[195,3978+6]..[195,3978+11]) + None + expression (test/basicStructures.t/input.re[195,3978+13]..[197,4018+3]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[196,3993+4]..[196,3993+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[196,3993+4]..[196,3993+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[196,3993+17]..[196,3993+22]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("one",(test/basicStructures.t/input.re[196,3993+17]..[196,3993+22]),None) + ] + Pexp_constant PConst_string("one",(test/basicStructures.t/input.re[196,3993+17]..[196,3993+22]),None) + ] + Some + expression (test/basicStructures.t/input.re[197,4018+9]..[199,4054+3]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[198,4029+4]..[198,4029+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[198,4029+4]..[198,4029+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[198,4029+17]..[198,4029+22]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("two",(test/basicStructures.t/input.re[198,4029+17]..[198,4029+22]),None) + ] + Pexp_constant PConst_string("two",(test/basicStructures.t/input.re[198,4029+17]..[198,4029+22]),None) + ] + None + structure_item (test/basicStructures.t/input.re[203,4086+0]..[209,4179+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[203,4086+0]..[209,4179+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[203,4086+3]..[203,4086+10]) + Pexp_construct "false" (test/basicStructures.t/input.re[203,4086+4]..[203,4086+9]) + None + expression (test/basicStructures.t/input.re[203,4086+11]..[209,4179+1]) + attribute "reason.preserve_braces" + [] + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[204,4099+5]..[204,4099+11]) + Pexp_construct "true" (test/basicStructures.t/input.re[204,4099+6]..[204,4099+10]) + None + expression (test/basicStructures.t/input.re[204,4099+12]..[206,4138+3]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[205,4113+4]..[205,4113+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[205,4113+4]..[205,4113+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[205,4113+17]..[205,4113+22]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("one",(test/basicStructures.t/input.re[205,4113+17]..[205,4113+22]),None) + ] + Pexp_constant PConst_string("one",(test/basicStructures.t/input.re[205,4113+17]..[205,4113+22]),None) + ] + Some + expression (test/basicStructures.t/input.re[206,4138+9]..[208,4174+3]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[207,4149+4]..[207,4149+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[207,4149+4]..[207,4149+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[207,4149+17]..[207,4149+22]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("two",(test/basicStructures.t/input.re[207,4149+17]..[207,4149+22]),None) + ] + Pexp_constant PConst_string("two",(test/basicStructures.t/input.re[207,4149+17]..[207,4149+22]),None) + ] + None + structure_item (test/basicStructures.t/input.re[216,4242+0]..[216,4242+33]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[216,4242+4]..[216,4242+26]) + Ppat_var "printIfFirstArgGreater" (test/basicStructures.t/input.re[216,4242+4]..[216,4242+26]) + expression (test/basicStructures.t/input.re[216,4242+29]..[216,4242+33]) + Pexp_construct "true" (test/basicStructures.t/input.re[216,4242+29]..[216,4242+33]) + None + ] + structure_item (test/basicStructures.t/input.re[217,4277+0]..[225,4593+3]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[217,4277+4]..[217,4277+10]) + Ppat_var "result" (test/basicStructures.t/input.re[217,4277+4]..[217,4277+10]) + expression (test/basicStructures.t/input.re[218,4290+2]..[225,4593+3]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[218,4290+5]..[218,4290+29]) + Pexp_ident "printIfFirstArgGreater" (test/basicStructures.t/input.re[218,4290+6]..[218,4290+28]) + expression (test/basicStructures.t/input.re[218,4290+30]..[220,4406+3]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[219,4322+8]..[219,4322+9]) + Ppat_var "a" (test/basicStructures.t/input.re[219,4322+8]..[219,4322+9]) + expression (test/basicStructures.t/input.re[219,4322+10]..[219,4322+82]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[219,4322+10]..[219,4322+11]) + Ppat_var "b" (test/basicStructures.t/input.re[219,4322+10]..[219,4322+11]) + expression (test/basicStructures.t/input.re[219,4322+16]..[219,4322+82]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[219,4322+19]..[219,4322+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[219,4322+22]..[219,4322+23]) + Pexp_ident ">" (test/basicStructures.t/input.re[219,4322+22]..[219,4322+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[219,4322+20]..[219,4322+21]) + Pexp_ident "a" (test/basicStructures.t/input.re[219,4322+20]..[219,4322+21]) + + Nolabel + expression (test/basicStructures.t/input.re[219,4322+24]..[219,4322+25]) + Pexp_ident "b" (test/basicStructures.t/input.re[219,4322+24]..[219,4322+25]) + ] + expression (test/basicStructures.t/input.re[219,4322+27]..[219,4322+51]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[219,4322+28]..[219,4322+40]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[219,4322+28]..[219,4322+40]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[219,4322+41]..[219,4322+48]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[219,4322+41]..[219,4322+48]),None) + ] + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[219,4322+41]..[219,4322+48]),None) + ] + Some + expression (test/basicStructures.t/input.re[219,4322+57]..[219,4322+82]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[219,4322+58]..[219,4322+70]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[219,4322+58]..[219,4322+70]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[219,4322+71]..[219,4322+79]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("b >= a",(test/basicStructures.t/input.re[219,4322+71]..[219,4322+79]),None) + ] + Pexp_constant PConst_string("b >= a",(test/basicStructures.t/input.re[219,4322+71]..[219,4322+79]),None) + ] + Some + expression (test/basicStructures.t/input.re[220,4406+9]..[225,4593+3]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[220,4406+12]..[222,4505+4]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[221,4421+8]..[221,4421+9]) + Ppat_var "a" (test/basicStructures.t/input.re[221,4421+8]..[221,4421+9]) + expression (test/basicStructures.t/input.re[221,4421+10]..[221,4421+82]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[221,4421+10]..[221,4421+11]) + Ppat_var "b" (test/basicStructures.t/input.re[221,4421+10]..[221,4421+11]) + expression (test/basicStructures.t/input.re[221,4421+16]..[221,4421+82]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[221,4421+19]..[221,4421+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[221,4421+22]..[221,4421+23]) + Pexp_ident ">" (test/basicStructures.t/input.re[221,4421+22]..[221,4421+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[221,4421+20]..[221,4421+21]) + Pexp_ident "a" (test/basicStructures.t/input.re[221,4421+20]..[221,4421+21]) + + Nolabel + expression (test/basicStructures.t/input.re[221,4421+24]..[221,4421+25]) + Pexp_ident "b" (test/basicStructures.t/input.re[221,4421+24]..[221,4421+25]) + ] + expression (test/basicStructures.t/input.re[221,4421+27]..[221,4421+51]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[221,4421+28]..[221,4421+40]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[221,4421+28]..[221,4421+40]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[221,4421+41]..[221,4421+48]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[221,4421+41]..[221,4421+48]),None) + ] + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[221,4421+41]..[221,4421+48]),None) + ] + Some + expression (test/basicStructures.t/input.re[221,4421+57]..[221,4421+82]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[221,4421+58]..[221,4421+70]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[221,4421+58]..[221,4421+70]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[221,4421+71]..[221,4421+79]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a <= b",(test/basicStructures.t/input.re[221,4421+71]..[221,4421+79]),None) + ] + Pexp_constant PConst_string("a <= b",(test/basicStructures.t/input.re[221,4421+71]..[221,4421+79]),None) + ] + expression (test/basicStructures.t/input.re[222,4505+5]..[225,4593+3]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[223,4512+4]..[223,4512+57]) + Pexp_apply + expression (test/basicStructures.t/input.re[223,4512+4]..[223,4512+16]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[223,4512+4]..[223,4512+16]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[223,4512+18]..[223,4512+56]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("That could never possibly type check",(test/basicStructures.t/input.re[223,4512+18]..[223,4512+56]),None) + ] + Pexp_constant PConst_string("That could never possibly type check",(test/basicStructures.t/input.re[223,4512+18]..[223,4512+56]),None) + ] + expression (test/basicStructures.t/input.re[224,4571+4]..[224,4571+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[224,4571+4]..[224,4571+17]) + Pexp_ident "print_newline" (test/basicStructures.t/input.re[224,4571+4]..[224,4571+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[224,4571+18]..[224,4571+20]) + Pexp_construct "()" (test/basicStructures.t/input.re[224,4571+18]..[224,4571+20]) + None + ] + None + ] + structure_item (test/basicStructures.t/input.re[228,4600+0]..[238,4898+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[228,4600+4]..[228,4600+12]) + Ppat_var "myRecord" (test/basicStructures.t/input.re[228,4600+4]..[228,4600+12]) + expression (test/basicStructures.t/input.re[228,4600+15]..[238,4898+1]) + Pexp_record + [ + "nestedRecord" (test/basicStructures.t/input.re[229,4617+2]..[229,4617+14]) + expression (test/basicStructures.t/input.re[229,4617+16]..[237,4894+3]) + Pexp_record + [ + "anotherNestedRecord" (test/basicStructures.t/input.re[230,4635+4]..[230,4635+23]) + expression (test/basicStructures.t/input.re[230,4635+25]..[236,4886+7]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[230,4635+29]..[230,4635+38]) + Ppat_var "instaComp" (test/basicStructures.t/input.re[230,4635+29]..[230,4635+38]) + expression (test/basicStructures.t/input.re[230,4635+39]..[236,4886+7]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[230,4635+39]..[230,4635+50]) + Ppat_var "displayRect" (test/basicStructures.t/input.re[230,4635+39]..[230,4635+50]) + expression (test/basicStructures.t/input.re[231,4690+6]..[236,4886+7]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[231,4690+9]..[232,4734+77]) + Pexp_apply + expression (test/basicStructures.t/input.re[231,4690+10]..[231,4690+43]) + Pexp_ident "Graphics.cgRectIntersectsWithSlop" (test/basicStructures.t/input.re[231,4690+10]..[231,4690+43]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[232,4734+11]..[232,4734+40]) + Pexp_ident "defaultCompositeTimerRectSlop" (test/basicStructures.t/input.re[232,4734+11]..[232,4734+40]) + + Nolabel + expression (test/basicStructures.t/input.re[232,4734+41]..[232,4734+63]) + Pexp_field + expression (test/basicStructures.t/input.re[232,4734+41]..[232,4734+50]) + Pexp_ident "instaComp" (test/basicStructures.t/input.re[232,4734+41]..[232,4734+50]) + "relativeRect" (test/basicStructures.t/input.re[232,4734+51]..[232,4734+63]) + + Nolabel + expression (test/basicStructures.t/input.re[232,4734+64]..[232,4734+75]) + Pexp_ident "displayRect" (test/basicStructures.t/input.re[232,4734+64]..[232,4734+75]) + ] + expression (test/basicStructures.t/input.re[232,4734+78]..[234,4834+7]) + attribute "reason.preserve_braces" + [] + Pexp_construct "IoEligible" (test/basicStructures.t/input.re[233,4814+8]..[233,4814+18]) + None + Some + expression (test/basicStructures.t/input.re[234,4834+13]..[236,4886+7]) + attribute "reason.preserve_braces" + [] + Pexp_construct "IoInelibleButTryComposition" (test/basicStructures.t/input.re[235,4849+8]..[235,4849+35]) + None + ] + None + ] + None + ] + structure_item (test/basicStructures.t/input.re[241,4903+0]..[243,4984+57]) + Pstr_eval + expression (test/basicStructures.t/input.re[241,4903+0]..[243,4984+57]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[241,4903+3]..[241,4903+27]) + Pexp_ident "printIfFirstArgGreater" (test/basicStructures.t/input.re[241,4903+4]..[241,4903+26]) + expression (test/basicStructures.t/input.re[241,4903+28]..[243,4984+1]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[242,4933+6]..[242,4933+7]) + Ppat_var "a" (test/basicStructures.t/input.re[242,4933+6]..[242,4933+7]) + expression (test/basicStructures.t/input.re[242,4933+8]..[242,4933+49]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[242,4933+8]..[242,4933+9]) + Ppat_var "b" (test/basicStructures.t/input.re[242,4933+8]..[242,4933+9]) + expression (test/basicStructures.t/input.re[242,4933+14]..[242,4933+49]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[242,4933+17]..[242,4933+24]) + Pexp_apply + expression (test/basicStructures.t/input.re[242,4933+20]..[242,4933+21]) + Pexp_ident ">" (test/basicStructures.t/input.re[242,4933+20]..[242,4933+21]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[242,4933+18]..[242,4933+19]) + Pexp_ident "a" (test/basicStructures.t/input.re[242,4933+18]..[242,4933+19]) + + Nolabel + expression (test/basicStructures.t/input.re[242,4933+22]..[242,4933+23]) + Pexp_ident "b" (test/basicStructures.t/input.re[242,4933+22]..[242,4933+23]) + ] + expression (test/basicStructures.t/input.re[242,4933+25]..[242,4933+49]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[242,4933+26]..[242,4933+38]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[242,4933+26]..[242,4933+38]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[242,4933+39]..[242,4933+46]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[242,4933+39]..[242,4933+46]),None) + ] + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[242,4933+39]..[242,4933+46]),None) + ] + None + Some + expression (test/basicStructures.t/input.re[243,4984+7]..[243,4984+57]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[243,4984+12]..[243,4984+13]) + Ppat_var "a" (test/basicStructures.t/input.re[243,4984+12]..[243,4984+13]) + expression (test/basicStructures.t/input.re[243,4984+14]..[243,4984+55]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[243,4984+14]..[243,4984+15]) + Ppat_var "b" (test/basicStructures.t/input.re[243,4984+14]..[243,4984+15]) + expression (test/basicStructures.t/input.re[243,4984+20]..[243,4984+55]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[243,4984+23]..[243,4984+30]) + Pexp_apply + expression (test/basicStructures.t/input.re[243,4984+26]..[243,4984+27]) + Pexp_ident ">" (test/basicStructures.t/input.re[243,4984+26]..[243,4984+27]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[243,4984+24]..[243,4984+25]) + Pexp_ident "a" (test/basicStructures.t/input.re[243,4984+24]..[243,4984+25]) + + Nolabel + expression (test/basicStructures.t/input.re[243,4984+28]..[243,4984+29]) + Pexp_ident "b" (test/basicStructures.t/input.re[243,4984+28]..[243,4984+29]) + ] + expression (test/basicStructures.t/input.re[243,4984+31]..[243,4984+55]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[243,4984+32]..[243,4984+44]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[243,4984+32]..[243,4984+44]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[243,4984+45]..[243,4984+52]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[243,4984+45]..[243,4984+52]),None) + ] + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[243,4984+45]..[243,4984+52]),None) + ] + None + structure_item (test/basicStructures.t/input.re[245,5133+0]..[252,5298+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[245,5133+0]..[252,5298+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[245,5133+3]..[245,5133+27]) + Pexp_ident "printIfFirstArgGreater" (test/basicStructures.t/input.re[245,5133+4]..[245,5133+26]) + expression (test/basicStructures.t/input.re[245,5133+28]..[252,5298+1]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[246,5163+6]..[246,5163+7]) + Ppat_var "a" (test/basicStructures.t/input.re[246,5163+6]..[246,5163+7]) + expression (test/basicStructures.t/input.re[246,5163+8]..[251,5291+5]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[246,5163+8]..[246,5163+9]) + Ppat_var "b" (test/basicStructures.t/input.re[246,5163+8]..[246,5163+9]) + expression (test/basicStructures.t/input.re[247,5177+4]..[251,5291+5]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[247,5177+7]..[247,5177+14]) + Pexp_apply + expression (test/basicStructures.t/input.re[247,5177+10]..[247,5177+11]) + Pexp_ident ">" (test/basicStructures.t/input.re[247,5177+10]..[247,5177+11]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[247,5177+8]..[247,5177+9]) + Pexp_ident "a" (test/basicStructures.t/input.re[247,5177+8]..[247,5177+9]) + + Nolabel + expression (test/basicStructures.t/input.re[247,5177+12]..[247,5177+13]) + Pexp_ident "b" (test/basicStructures.t/input.re[247,5177+12]..[247,5177+13]) + ] + expression (test/basicStructures.t/input.re[247,5177+15]..[249,5223+5]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[248,5194+6]..[248,5194+18]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[248,5194+6]..[248,5194+18]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[248,5194+19]..[248,5194+26]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[248,5194+19]..[248,5194+26]),None) + ] + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[248,5194+19]..[248,5194+26]),None) + ] + Some + expression (test/basicStructures.t/input.re[249,5223+11]..[251,5291+5]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[250,5236+10]..[250,5236+11]) + Ppat_var "a" (test/basicStructures.t/input.re[250,5236+10]..[250,5236+11]) + expression (test/basicStructures.t/input.re[250,5236+12]..[250,5236+53]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[250,5236+12]..[250,5236+13]) + Ppat_var "b" (test/basicStructures.t/input.re[250,5236+12]..[250,5236+13]) + expression (test/basicStructures.t/input.re[250,5236+18]..[250,5236+53]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[250,5236+21]..[250,5236+28]) + Pexp_apply + expression (test/basicStructures.t/input.re[250,5236+24]..[250,5236+25]) + Pexp_ident ">" (test/basicStructures.t/input.re[250,5236+24]..[250,5236+25]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[250,5236+22]..[250,5236+23]) + Pexp_ident "a" (test/basicStructures.t/input.re[250,5236+22]..[250,5236+23]) + + Nolabel + expression (test/basicStructures.t/input.re[250,5236+26]..[250,5236+27]) + Pexp_ident "b" (test/basicStructures.t/input.re[250,5236+26]..[250,5236+27]) + ] + expression (test/basicStructures.t/input.re[250,5236+29]..[250,5236+53]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[250,5236+30]..[250,5236+42]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[250,5236+30]..[250,5236+42]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[250,5236+43]..[250,5236+50]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[250,5236+43]..[250,5236+50]),None) + ] + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[250,5236+43]..[250,5236+50]),None) + ] + None + None + structure_item (test/basicStructures.t/input.re[254,5302+0]..[254,5302+47]) + Pstr_eval + expression (test/basicStructures.t/input.re[254,5302+0]..[254,5302+47]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[254,5302+4]..[254,5302+5]) + Ppat_var "a" (test/basicStructures.t/input.re[254,5302+4]..[254,5302+5]) + expression (test/basicStructures.t/input.re[254,5302+6]..[254,5302+47]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[254,5302+6]..[254,5302+7]) + Ppat_var "b" (test/basicStructures.t/input.re[254,5302+6]..[254,5302+7]) + expression (test/basicStructures.t/input.re[254,5302+12]..[254,5302+47]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[254,5302+15]..[254,5302+22]) + Pexp_apply + expression (test/basicStructures.t/input.re[254,5302+18]..[254,5302+19]) + Pexp_ident ">" (test/basicStructures.t/input.re[254,5302+18]..[254,5302+19]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[254,5302+16]..[254,5302+17]) + Pexp_ident "a" (test/basicStructures.t/input.re[254,5302+16]..[254,5302+17]) + + Nolabel + expression (test/basicStructures.t/input.re[254,5302+20]..[254,5302+21]) + Pexp_ident "b" (test/basicStructures.t/input.re[254,5302+20]..[254,5302+21]) + ] + expression (test/basicStructures.t/input.re[254,5302+23]..[254,5302+47]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[254,5302+24]..[254,5302+36]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[254,5302+24]..[254,5302+36]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[254,5302+37]..[254,5302+44]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[254,5302+37]..[254,5302+44]),None) + ] + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[254,5302+37]..[254,5302+44]),None) + ] + None + structure_item (test/basicStructures.t/input.re[257,5388+0]..[261,5533+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[257,5388+0]..[261,5533+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[257,5388+3]..[257,5388+27]) + Pexp_ident "printIfFirstArgGreater" (test/basicStructures.t/input.re[257,5388+4]..[257,5388+26]) + expression (test/basicStructures.t/input.re[257,5388+28]..[259,5471+1]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[258,5418+6]..[258,5418+7]) + Ppat_var "a" (test/basicStructures.t/input.re[258,5418+6]..[258,5418+7]) + expression (test/basicStructures.t/input.re[258,5418+8]..[258,5418+51]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[258,5418+8]..[258,5418+9]) + Ppat_var "b" (test/basicStructures.t/input.re[258,5418+8]..[258,5418+9]) + expression (test/basicStructures.t/input.re[258,5418+14]..[258,5418+51]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[258,5418+18]..[258,5418+25]) + Pexp_apply + expression (test/basicStructures.t/input.re[258,5418+21]..[258,5418+22]) + Pexp_ident ">" (test/basicStructures.t/input.re[258,5418+21]..[258,5418+22]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[258,5418+19]..[258,5418+20]) + Pexp_ident "a" (test/basicStructures.t/input.re[258,5418+19]..[258,5418+20]) + + Nolabel + expression (test/basicStructures.t/input.re[258,5418+23]..[258,5418+24]) + Pexp_ident "b" (test/basicStructures.t/input.re[258,5418+23]..[258,5418+24]) + ] + expression (test/basicStructures.t/input.re[258,5418+26]..[258,5418+50]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[258,5418+27]..[258,5418+39]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[258,5418+27]..[258,5418+39]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[258,5418+40]..[258,5418+47]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[258,5418+40]..[258,5418+47]),None) + ] + Pexp_constant PConst_string("a > b",(test/basicStructures.t/input.re[258,5418+40]..[258,5418+47]),None) + ] + None + Some + expression (test/basicStructures.t/input.re[259,5471+7]..[261,5533+1]) + attribute "reason.preserve_braces" + [] + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[260,5480+6]..[260,5480+7]) + Ppat_var "a" (test/basicStructures.t/input.re[260,5480+6]..[260,5480+7]) + expression (test/basicStructures.t/input.re[260,5480+8]..[260,5480+51]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[260,5480+8]..[260,5480+9]) + Ppat_var "b" (test/basicStructures.t/input.re[260,5480+8]..[260,5480+9]) + expression (test/basicStructures.t/input.re[260,5480+14]..[260,5480+51]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[260,5480+18]..[260,5480+25]) + Pexp_apply + expression (test/basicStructures.t/input.re[260,5480+21]..[260,5480+22]) + Pexp_ident ">" (test/basicStructures.t/input.re[260,5480+21]..[260,5480+22]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[260,5480+19]..[260,5480+20]) + Pexp_ident "a" (test/basicStructures.t/input.re[260,5480+19]..[260,5480+20]) + + Nolabel + expression (test/basicStructures.t/input.re[260,5480+23]..[260,5480+24]) + Pexp_ident "b" (test/basicStructures.t/input.re[260,5480+23]..[260,5480+24]) + ] + expression (test/basicStructures.t/input.re[260,5480+26]..[260,5480+50]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[260,5480+27]..[260,5480+39]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[260,5480+27]..[260,5480+39]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[260,5480+40]..[260,5480+47]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[260,5480+40]..[260,5480+47]),None) + ] + Pexp_constant PConst_string("b < a",(test/basicStructures.t/input.re[260,5480+40]..[260,5480+47]),None) + ] + None + structure_item (test/basicStructures.t/input.re[264,5601+0]..[270,5771+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[264,5601+0]..[270,5771+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[264,5601+3]..[264,5601+13]) + Pexp_apply + expression (test/basicStructures.t/input.re[264,5601+7]..[264,5601+8]) + Pexp_ident "<" (test/basicStructures.t/input.re[264,5601+7]..[264,5601+8]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[264,5601+4]..[264,5601+6]) + Pexp_constant PConst_int (10,None) + + Nolabel + expression (test/basicStructures.t/input.re[264,5601+9]..[264,5601+12]) + Pexp_constant PConst_int (100,None) + ] + expression (test/basicStructures.t/input.re[264,5601+14]..[267,5707+1]) + attribute "reason.preserve_braces" + [] + Pexp_let Nonrec + [ + + pattern (test/basicStructures.t/input.re[265,5617+6]..[265,5617+9]) + Ppat_var "msg" (test/basicStructures.t/input.re[265,5617+6]..[265,5617+9]) + expression (test/basicStructures.t/input.re[265,5617+12]..[265,5617+66]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("If there was any doubt, 10 is in fact less than 100.",(test/basicStructures.t/input.re[265,5617+12]..[265,5617+66]),None) + ] + Pexp_constant PConst_string("If there was any doubt, 10 is in fact less than 100.",(test/basicStructures.t/input.re[265,5617+12]..[265,5617+66]),None) + ] + expression (test/basicStructures.t/input.re[266,5685+2]..[266,5685+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[266,5685+2]..[266,5685+14]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[266,5685+2]..[266,5685+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[266,5685+16]..[266,5685+19]) + Pexp_ident "msg" (test/basicStructures.t/input.re[266,5685+16]..[266,5685+19]) + ] + Some + expression (test/basicStructures.t/input.re[267,5707+7]..[270,5771+1]) + attribute "reason.preserve_braces" + [] + Pexp_let Nonrec + [ + + pattern (test/basicStructures.t/input.re[268,5716+6]..[268,5716+9]) + Ppat_var "msg" (test/basicStructures.t/input.re[268,5716+6]..[268,5716+9]) + expression (test/basicStructures.t/input.re[268,5716+12]..[268,5716+31]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("All bets are off.",(test/basicStructures.t/input.re[268,5716+12]..[268,5716+31]),None) + ] + Pexp_constant PConst_string("All bets are off.",(test/basicStructures.t/input.re[268,5716+12]..[268,5716+31]),None) + ] + expression (test/basicStructures.t/input.re[269,5749+2]..[269,5749+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[269,5749+2]..[269,5749+14]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[269,5749+2]..[269,5749+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[269,5749+16]..[269,5749+19]) + Pexp_ident "msg" (test/basicStructures.t/input.re[269,5749+16]..[269,5749+19]) + ] + structure_item (test/basicStructures.t/input.re[272,5775+0]..[276,5911+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[272,5775+0]..[276,5911+1]) + Pexp_ifthenelse + expression (test/basicStructures.t/input.re[272,5775+3]..[272,5775+13]) + Pexp_apply + expression (test/basicStructures.t/input.re[272,5775+7]..[272,5775+8]) + Pexp_ident "<" (test/basicStructures.t/input.re[272,5775+7]..[272,5775+8]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[272,5775+4]..[272,5775+6]) + Pexp_constant PConst_int (10,None) + + Nolabel + expression (test/basicStructures.t/input.re[272,5775+9]..[272,5775+12]) + Pexp_constant PConst_int (100,None) + ] + expression (test/basicStructures.t/input.re[272,5775+14]..[274,5864+1]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[273,5791+2]..[273,5791+14]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[273,5791+2]..[273,5791+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[273,5791+16]..[273,5791+70]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("If there was any doubt, 10 is in fact less than 100.",(test/basicStructures.t/input.re[273,5791+16]..[273,5791+70]),None) + ] + Pexp_constant PConst_string("If there was any doubt, 10 is in fact less than 100.",(test/basicStructures.t/input.re[273,5791+16]..[273,5791+70]),None) + ] + Some + expression (test/basicStructures.t/input.re[274,5864+7]..[276,5911+1]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[275,5873+2]..[275,5873+14]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[275,5873+2]..[275,5873+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[275,5873+16]..[275,5873+35]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("All bets are off.",(test/basicStructures.t/input.re[275,5873+16]..[275,5873+35]),None) + ] + Pexp_constant PConst_string("All bets are off.",(test/basicStructures.t/input.re[275,5873+16]..[275,5873+35]),None) + ] + structure_item (test/basicStructures.t/input.re[279,5916+0]..[281,6043+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[279,5916+0]..[281,6043+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[279,5916+0]..[281,6043+3]) + Pexp_constant PConst_string(" TYPE CONSTRAINTS\n *============================================================================\n ",(test/basicStructures.t/input.re[279,5916+0]..[281,6043+3]),None) + ] + structure_item (test/basicStructures.t/input.re[282,6048+0]..[282,6048+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[282,6048+4]..[282,6048+5]) + Ppat_var "x" (test/basicStructures.t/input.re[282,6048+4]..[282,6048+5]) + expression (test/basicStructures.t/input.re[282,6048+8]..[282,6048+16]) + Pexp_constraint + expression (test/basicStructures.t/input.re[282,6048+9]..[282,6048+11]) + Pexp_constant PConst_int (10,None) + core_type (test/basicStructures.t/input.re[282,6048+12]..[282,6048+15]) + Ptyp_constr "int" (test/basicStructures.t/input.re[282,6048+12]..[282,6048+15]) + [] + ] + structure_item (test/basicStructures.t/input.re[283,6066+0]..[283,6066+14]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[283,6066+4]..[283,6066+5]) + Ppat_var "x" (test/basicStructures.t/input.re[283,6066+4]..[283,6066+5]) + expression (test/basicStructures.t/input.re[283,6066+4]..[283,6066+14]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[283,6066+12]..[283,6066+14]) + Pexp_constant PConst_int (10,None) + core_type (test/basicStructures.t/input.re[283,6066+6]..[283,6066+9]) + Ptyp_constr "int" (test/basicStructures.t/input.re[283,6066+6]..[283,6066+9]) + [] + ] + structure_item (test/basicStructures.t/input.re[284,6082+0]..[284,6082+16]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[284,6082+4]..[284,6082+11]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[284,6082+5]..[284,6082+6]) + Ppat_var "x" (test/basicStructures.t/input.re[284,6082+5]..[284,6082+6]) + core_type (test/basicStructures.t/input.re[284,6082+7]..[284,6082+10]) + Ptyp_constr "int" (test/basicStructures.t/input.re[284,6082+7]..[284,6082+10]) + [] + expression (test/basicStructures.t/input.re[284,6082+14]..[284,6082+16]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[285,6100+0]..[285,6100+22]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[285,6100+4]..[285,6100+11]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[285,6100+5]..[285,6100+6]) + Ppat_var "x" (test/basicStructures.t/input.re[285,6100+5]..[285,6100+6]) + core_type (test/basicStructures.t/input.re[285,6100+7]..[285,6100+10]) + Ptyp_constr "int" (test/basicStructures.t/input.re[285,6100+7]..[285,6100+10]) + [] + expression (test/basicStructures.t/input.re[285,6100+14]..[285,6100+22]) + Pexp_constraint + expression (test/basicStructures.t/input.re[285,6100+15]..[285,6100+17]) + Pexp_constant PConst_int (10,None) + core_type (test/basicStructures.t/input.re[285,6100+18]..[285,6100+21]) + Ptyp_constr "int" (test/basicStructures.t/input.re[285,6100+18]..[285,6100+21]) + [] + ] + structure_item (test/basicStructures.t/input.re[289,6196+0]..[291,6313+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[289,6196+0]..[291,6313+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[289,6196+0]..[291,6313+3]) + Pexp_constant PConst_string(" TUPLES\n *============================================================================\n ",(test/basicStructures.t/input.re[289,6196+0]..[291,6313+3]),None) + ] + structure_item (test/basicStructures.t/input.re[294,6398+0]..[294,6398+28]) + Pstr_type Rec + [ + type_declaration "pairOfInts" (test/basicStructures.t/input.re[294,6398+5]..[294,6398+15]) (test/basicStructures.t/input.re[294,6398+0]..[294,6398+28]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_abstract + ptype_private = Public + ptype_manifest = + Some + core_type (test/basicStructures.t/input.re[294,6398+18]..[294,6398+28]) + Ptyp_tuple + [ + core_type (test/basicStructures.t/input.re[294,6398+19]..[294,6398+22]) + Ptyp_constr "int" (test/basicStructures.t/input.re[294,6398+19]..[294,6398+22]) + [] + core_type (test/basicStructures.t/input.re[294,6398+24]..[294,6398+27]) + Ptyp_constr "int" (test/basicStructures.t/input.re[294,6398+24]..[294,6398+27]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[295,6428+0]..[295,6428+43]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[295,6428+4]..[295,6428+38]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[295,6428+5]..[295,6428+33]) + Ppat_var "letBindingWithTypeConstraint" (test/basicStructures.t/input.re[295,6428+5]..[295,6428+33]) + core_type (test/basicStructures.t/input.re[295,6428+34]..[295,6428+37]) + Ptyp_constr "int" (test/basicStructures.t/input.re[295,6428+34]..[295,6428+37]) + [] + expression (test/basicStructures.t/input.re[295,6428+41]..[295,6428+43]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[296,6473+0]..[296,6473+58]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[296,6473+4]..[296,6473+47]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[296,6473+5]..[296,6473+20]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[296,6473+6]..[296,6473+15]) + Ppat_var "tupleItem" (test/basicStructures.t/input.re[296,6473+6]..[296,6473+15]) + core_type (test/basicStructures.t/input.re[296,6473+16]..[296,6473+19]) + Ptyp_constr "int" (test/basicStructures.t/input.re[296,6473+16]..[296,6473+19]) + [] + pattern (test/basicStructures.t/input.re[296,6473+22]..[296,6473+46]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[296,6473+23]..[296,6473+41]) + Ppat_var "withTypeConstraint" (test/basicStructures.t/input.re[296,6473+23]..[296,6473+41]) + core_type (test/basicStructures.t/input.re[296,6473+42]..[296,6473+45]) + Ptyp_constr "int" (test/basicStructures.t/input.re[296,6473+42]..[296,6473+45]) + [] + ] + expression (test/basicStructures.t/input.re[296,6473+50]..[296,6473+58]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[296,6473+51]..[296,6473+53]) + Pexp_constant PConst_int (10,None) + expression (test/basicStructures.t/input.re[296,6473+55]..[296,6473+57]) + Pexp_constant PConst_int (20,None) + ] + ] + structure_item (test/basicStructures.t/input.re[299,6614+0]..[299,6614+22]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[299,6614+4]..[299,6614+14]) + Ppat_var "_dummyFunc" (test/basicStructures.t/input.re[299,6614+4]..[299,6614+14]) + expression (test/basicStructures.t/input.re[299,6614+15]..[299,6614+22]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[299,6614+15]..[299,6614+16]) + Ppat_var "x" (test/basicStructures.t/input.re[299,6614+15]..[299,6614+16]) + expression (test/basicStructures.t/input.re[299,6614+20]..[299,6614+22]) + Pexp_constant PConst_int (10,None) + ] + structure_item (test/basicStructures.t/input.re[300,6638+0]..[300,6638+74]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[300,6638+4]..[300,6638+29]) + Ppat_var "annotatingFuncApplication" (test/basicStructures.t/input.re[300,6638+4]..[300,6638+29]) + expression (test/basicStructures.t/input.re[300,6638+32]..[300,6638+74]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[300,6638+33]..[300,6638+52]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[300,6638+33]..[300,6638+48]) + Pexp_apply + expression (test/basicStructures.t/input.re[300,6638+33]..[300,6638+43]) + Pexp_ident "_dummyFunc" (test/basicStructures.t/input.re[300,6638+33]..[300,6638+43]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[300,6638+44]..[300,6638+47]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a",(test/basicStructures.t/input.re[300,6638+44]..[300,6638+47]),None) + ] + Pexp_constant PConst_string("a",(test/basicStructures.t/input.re[300,6638+44]..[300,6638+47]),None) + ] + core_type (test/basicStructures.t/input.re[300,6638+49]..[300,6638+52]) + Ptyp_constr "int" (test/basicStructures.t/input.re[300,6638+49]..[300,6638+52]) + [] + expression (test/basicStructures.t/input.re[300,6638+54]..[300,6638+73]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[300,6638+54]..[300,6638+69]) + Pexp_apply + expression (test/basicStructures.t/input.re[300,6638+54]..[300,6638+64]) + Pexp_ident "_dummyFunc" (test/basicStructures.t/input.re[300,6638+54]..[300,6638+64]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[300,6638+65]..[300,6638+68]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a",(test/basicStructures.t/input.re[300,6638+65]..[300,6638+68]),None) + ] + Pexp_constant PConst_string("a",(test/basicStructures.t/input.re[300,6638+65]..[300,6638+68]),None) + ] + core_type (test/basicStructures.t/input.re[300,6638+70]..[300,6638+73]) + Ptyp_constr "int" (test/basicStructures.t/input.re[300,6638+70]..[300,6638+73]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[303,6772+0]..[303,6772+59]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[303,6772+4]..[303,6772+35]) + Ppat_var "annotatingSingleFuncApplication" (test/basicStructures.t/input.re[303,6772+4]..[303,6772+35]) + expression (test/basicStructures.t/input.re[303,6772+38]..[303,6772+59]) + Pexp_constraint + expression (test/basicStructures.t/input.re[303,6772+39]..[303,6772+54]) + Pexp_apply + expression (test/basicStructures.t/input.re[303,6772+39]..[303,6772+49]) + Pexp_ident "_dummyFunc" (test/basicStructures.t/input.re[303,6772+39]..[303,6772+49]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[303,6772+50]..[303,6772+53]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("a",(test/basicStructures.t/input.re[303,6772+50]..[303,6772+53]),None) + ] + Pexp_constant PConst_string("a",(test/basicStructures.t/input.re[303,6772+50]..[303,6772+53]),None) + ] + core_type (test/basicStructures.t/input.re[303,6772+55]..[303,6772+58]) + Ptyp_constr "int" (test/basicStructures.t/input.re[303,6772+55]..[303,6772+58]) + [] + ] + structure_item (test/basicStructures.t/input.re[306,6875+0]..[316,7200+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[306,6875+4]..[306,6875+35]) + Ppat_var "annotatingSingleFuncApplication" (test/basicStructures.t/input.re[306,6875+4]..[306,6875+35]) + expression (test/basicStructures.t/input.re[306,6875+38]..[316,7200+1]) + attribute "reason.preserve_braces" + [] + Pexp_let Nonrec + [ + + pattern (test/basicStructures.t/input.re[308,6949+6]..[308,6949+7]) + Ppat_var "a" (test/basicStructures.t/input.re[308,6949+6]..[308,6949+7]) + expression (test/basicStructures.t/input.re[308,6949+10]..[308,6949+13]) + Pexp_constant PConst_int (100,None) + ] + expression (test/basicStructures.t/input.re[310,7004+2]..[315,7173+26]) + Pexp_let Nonrec + [ + + pattern (test/basicStructures.t/input.re[310,7004+6]..[310,7004+9]) + Ppat_var "int" (test/basicStructures.t/input.re[310,7004+6]..[310,7004+9]) + expression (test/basicStructures.t/input.re[310,7004+12]..[310,7004+15]) + Pexp_constant PConst_int (200,None) + ] + expression (test/basicStructures.t/input.re[315,7173+2]..[315,7173+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[315,7173+4]..[315,7173+5]) + Pexp_ident "+" (test/basicStructures.t/input.re[315,7173+4]..[315,7173+5]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[315,7173+2]..[315,7173+3]) + Pexp_constant PConst_int (2,None) + + Nolabel + expression (test/basicStructures.t/input.re[315,7173+6]..[315,7173+25]) + Pexp_constraint + expression (test/basicStructures.t/input.re[315,7173+7]..[315,7173+20]) + Pexp_apply + expression (test/basicStructures.t/input.re[315,7173+7]..[315,7173+17]) + Pexp_ident "_dummyFunc" (test/basicStructures.t/input.re[315,7173+7]..[315,7173+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[315,7173+18]..[315,7173+19]) + Pexp_ident "a" (test/basicStructures.t/input.re[315,7173+18]..[315,7173+19]) + ] + core_type (test/basicStructures.t/input.re[315,7173+21]..[315,7173+24]) + Ptyp_constr "int" (test/basicStructures.t/input.re[315,7173+21]..[315,7173+24]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[318,7204+0]..[318,7204+62]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[318,7204+4]..[318,7204+51]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[318,7204+5]..[318,7204+18]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[318,7204+5]..[318,7204+14]) + Ppat_var "tupleItem" (test/basicStructures.t/input.re[318,7204+5]..[318,7204+14]) + core_type (test/basicStructures.t/input.re[318,7204+15]..[318,7204+18]) + Ptyp_constr "int" (test/basicStructures.t/input.re[318,7204+15]..[318,7204+18]) + [] + pattern (test/basicStructures.t/input.re[318,7204+20]..[318,7204+50]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[318,7204+20]..[318,7204+46]) + Ppat_var "constrainedWithoutGrouping" (test/basicStructures.t/input.re[318,7204+20]..[318,7204+46]) + core_type (test/basicStructures.t/input.re[318,7204+47]..[318,7204+50]) + Ptyp_constr "int" (test/basicStructures.t/input.re[318,7204+47]..[318,7204+50]) + [] + ] + expression (test/basicStructures.t/input.re[318,7204+54]..[318,7204+62]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[318,7204+55]..[318,7204+57]) + Pexp_constant PConst_int (10,None) + expression (test/basicStructures.t/input.re[318,7204+59]..[318,7204+61]) + Pexp_constant PConst_int (20,None) + ] + ] + structure_item (test/basicStructures.t/input.re[319,7268+0]..[319,7268+63]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[319,7268+4]..[319,7268+63]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[319,7268+4]..[319,7268+42]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[319,7268+5]..[319,7268+14]) + Ppat_var "tupleItem" (test/basicStructures.t/input.re[319,7268+5]..[319,7268+14]) + pattern (test/basicStructures.t/input.re[319,7268+16]..[319,7268+41]) + Ppat_var "withOutsideTypeConstraint" (test/basicStructures.t/input.re[319,7268+16]..[319,7268+41]) + ] + core_type (test/basicStructures.t/input.re[319,7268+43]..[319,7268+52]) + Ptyp_tuple + [ + core_type (test/basicStructures.t/input.re[319,7268+44]..[319,7268+47]) + Ptyp_constr "int" (test/basicStructures.t/input.re[319,7268+44]..[319,7268+47]) + [] + core_type (test/basicStructures.t/input.re[319,7268+48]..[319,7268+51]) + Ptyp_constr "int" (test/basicStructures.t/input.re[319,7268+48]..[319,7268+51]) + [] + ] + expression (test/basicStructures.t/input.re[319,7268+55]..[319,7268+63]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[319,7268+56]..[319,7268+58]) + Pexp_constant PConst_int (10,None) + expression (test/basicStructures.t/input.re[319,7268+60]..[319,7268+62]) + Pexp_constant PConst_int (20,None) + ] + ] + structure_item (test/basicStructures.t/input.re[322,7356+0]..[322,7356+35]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[322,7356+4]..[322,7356+25]) + Ppat_var "trailingCommaAccepted" (test/basicStructures.t/input.re[322,7356+4]..[322,7356+25]) + expression (test/basicStructures.t/input.re[322,7356+28]..[322,7356+35]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[322,7356+29]..[322,7356+30]) + Pexp_constant PConst_int (1,None) + expression (test/basicStructures.t/input.re[322,7356+32]..[322,7356+33]) + Pexp_constant PConst_int (2,None) + ] + ] + structure_item (test/basicStructures.t/input.re[323,7393+0]..[323,7393+39]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[323,7393+4]..[323,7393+16]) + Ppat_var "moreTrailing" (test/basicStructures.t/input.re[323,7393+4]..[323,7393+16]) + expression (test/basicStructures.t/input.re[323,7393+19]..[323,7393+39]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[323,7393+20]..[323,7393+21]) + Pexp_constant PConst_int (1,None) + expression (test/basicStructures.t/input.re[323,7393+23]..[323,7393+24]) + Pexp_constant PConst_int (2,None) + expression (test/basicStructures.t/input.re[323,7393+26]..[323,7393+27]) + Pexp_constant PConst_int (3,None) + expression (test/basicStructures.t/input.re[323,7393+29]..[323,7393+30]) + Pexp_constant PConst_int (4,None) + expression (test/basicStructures.t/input.re[323,7393+32]..[323,7393+33]) + Pexp_constant PConst_int (5,None) + expression (test/basicStructures.t/input.re[323,7393+35]..[323,7393+36]) + Pexp_constant PConst_int (7,None) + ] + ] + structure_item (test/basicStructures.t/input.re[325,7435+0]..[327,7558+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[325,7435+0]..[327,7558+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[325,7435+0]..[327,7558+3]) + Pexp_constant PConst_string(" Immutable Lists\n * ============================================================================\n ",(test/basicStructures.t/input.re[325,7435+0]..[327,7558+3]),None) + ] + structure_item (test/basicStructures.t/input.re[330,7646+0]..[330,7646+55]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[330,7646+4]..[330,7646+5]) + Ppat_var "x" (test/basicStructures.t/input.re[330,7646+4]..[330,7646+5]) + expression (test/basicStructures.t/input.re[330,7646+4]..[330,7646+55]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[330,7646+19]..[330,7646+55]) + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+24]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+24]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+24]..[330,7646+25]) + Pexp_constant PConst_int (1,None) + expression (test/basicStructures.t/input.re[330,7646+32]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+32]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+32]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+32]..[330,7646+33]) + Pexp_constant PConst_int (2,None) + expression (test/basicStructures.t/input.re[330,7646+35]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+35]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+35]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+35]..[330,7646+36]) + Pexp_constant PConst_int (3,None) + expression (test/basicStructures.t/input.re[330,7646+38]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+38]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+38]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+38]..[330,7646+39]) + Pexp_constant PConst_int (4,None) + expression (test/basicStructures.t/input.re[330,7646+41]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+41]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+41]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+41]..[330,7646+42]) + Pexp_constant PConst_int (5,None) + expression (test/basicStructures.t/input.re[330,7646+44]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+44]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+44]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+44]..[330,7646+45]) + Pexp_constant PConst_int (6,None) + expression (test/basicStructures.t/input.re[330,7646+47]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+47]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+47]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+47]..[330,7646+48]) + Pexp_constant PConst_int (7,None) + expression (test/basicStructures.t/input.re[330,7646+50]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+50]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+50]..[330,7646+54]) ghost +Pexp_tuple +[ + expression (test/basicStructures.t/input.re[330,7646+50]..[330,7646+51]) + Pexp_constant PConst_int (8,None) + expression (test/basicStructures.t/input.re[330,7646+53]..[330,7646+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[330,7646+53]..[330,7646+54]) + Some + expression (test/basicStructures.t/input.re[330,7646+53]..[330,7646+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[330,7646+53]..[330,7646+54]) + Pexp_constant PConst_int (9,None) + expression (test/basicStructures.t/input.re[330,7646+20]..[330,7646+54]) ghost + Pexp_construct "[]" (test/basicStructures.t/input.re[330,7646+20]..[330,7646+54]) ghost + None + ] +] + ] + ] + ] + ] + ] + ] + ] + core_type (test/basicStructures.t/input.re[330,7646+7]..[330,7646+16]) + Ptyp_constr "list" (test/basicStructures.t/input.re[330,7646+7]..[330,7646+11]) + [ + core_type (test/basicStructures.t/input.re[330,7646+12]..[330,7646+15]) + Ptyp_constr "int" (test/basicStructures.t/input.re[330,7646+12]..[330,7646+15]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[331,7703+0]..[331,7703+25]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[331,7703+4]..[331,7703+6]) + Ppat_var "hd" (test/basicStructures.t/input.re[331,7703+4]..[331,7703+6]) + expression (test/basicStructures.t/input.re[331,7703+9]..[331,7703+25]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("appendedToHead",(test/basicStructures.t/input.re[331,7703+9]..[331,7703+25]),None) + ] + Pexp_constant PConst_string("appendedToHead",(test/basicStructures.t/input.re[331,7703+9]..[331,7703+25]),None) + ] + structure_item (test/basicStructures.t/input.re[332,7730+0]..[332,7730+35]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[332,7730+4]..[332,7730+6]) + Ppat_var "tl" (test/basicStructures.t/input.re[332,7730+4]..[332,7730+6]) + expression (test/basicStructures.t/input.re[332,7730+9]..[332,7730+35]) + Pexp_construct "::" (test/basicStructures.t/input.re[332,7730+10]..[332,7730+34]) + Some + expression (test/basicStructures.t/input.re[332,7730+10]..[332,7730+34]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[332,7730+10]..[332,7730+18]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("listTo",(test/basicStructures.t/input.re[332,7730+10]..[332,7730+18]),None) + ] + Pexp_constant PConst_string("listTo",(test/basicStructures.t/input.re[332,7730+10]..[332,7730+18]),None) + expression (test/basicStructures.t/input.re[332,7730+20]..[332,7730+34]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[332,7730+20]..[332,7730+34]) + Some + expression (test/basicStructures.t/input.re[332,7730+20]..[332,7730+34]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[332,7730+20]..[332,7730+28]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("append",(test/basicStructures.t/input.re[332,7730+20]..[332,7730+28]),None) + ] + Pexp_constant PConst_string("append",(test/basicStructures.t/input.re[332,7730+20]..[332,7730+28]),None) + expression (test/basicStructures.t/input.re[332,7730+30]..[332,7730+34]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[332,7730+30]..[332,7730+34]) + Some + expression (test/basicStructures.t/input.re[332,7730+30]..[332,7730+34]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[332,7730+30]..[332,7730+34]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("to",(test/basicStructures.t/input.re[332,7730+30]..[332,7730+34]),None) + ] + Pexp_constant PConst_string("to",(test/basicStructures.t/input.re[332,7730+30]..[332,7730+34]),None) + expression (test/basicStructures.t/input.re[332,7730+10]..[332,7730+34]) ghost + Pexp_construct "[]" (test/basicStructures.t/input.re[332,7730+10]..[332,7730+34]) ghost + None + ] + ] + ] + ] + structure_item (test/basicStructures.t/input.re[335,7849+0]..[335,7849+38]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[335,7849+4]..[335,7849+10]) + Ppat_var "result" (test/basicStructures.t/input.re[335,7849+4]..[335,7849+10]) + expression (test/basicStructures.t/input.re[335,7849+4]..[335,7849+38]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[335,7849+27]..[335,7849+38]) + Pexp_construct "::" (test/basicStructures.t/input.re[335,7849+28]..[335,7849+37]) + Some + expression (test/basicStructures.t/input.re[335,7849+28]..[335,7849+37]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[335,7849+28]..[335,7849+30]) + Pexp_ident "hd" (test/basicStructures.t/input.re[335,7849+28]..[335,7849+30]) + expression (test/basicStructures.t/input.re[335,7849+35]..[335,7849+37]) + Pexp_ident "tl" (test/basicStructures.t/input.re[335,7849+35]..[335,7849+37]) + ] + core_type (test/basicStructures.t/input.re[335,7849+12]..[335,7849+24]) + Ptyp_constr "list" (test/basicStructures.t/input.re[335,7849+12]..[335,7849+16]) + [ + core_type (test/basicStructures.t/input.re[335,7849+17]..[335,7849+23]) + Ptyp_constr "string" (test/basicStructures.t/input.re[335,7849+17]..[335,7849+23]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[338,7919+0]..[338,7919+71]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[338,7919+4]..[338,7919+10]) + Ppat_var "result" (test/basicStructures.t/input.re[338,7919+4]..[338,7919+10]) + expression (test/basicStructures.t/input.re[338,7919+4]..[338,7919+71]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[338,7919+27]..[338,7919+71]) + Pexp_construct "::" (test/basicStructures.t/input.re[338,7919+28]..[338,7919+70]) + Some + expression (test/basicStructures.t/input.re[338,7919+28]..[338,7919+70]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[338,7919+28]..[338,7919+44]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("appendedToHead",(test/basicStructures.t/input.re[338,7919+28]..[338,7919+44]),None) + ] + Pexp_constant PConst_string("appendedToHead",(test/basicStructures.t/input.re[338,7919+28]..[338,7919+44]),None) + expression (test/basicStructures.t/input.re[338,7919+46]..[338,7919+70]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[338,7919+46]..[338,7919+70]) + Some + expression (test/basicStructures.t/input.re[338,7919+46]..[338,7919+70]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[338,7919+46]..[338,7919+54]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("listTo",(test/basicStructures.t/input.re[338,7919+46]..[338,7919+54]),None) + ] + Pexp_constant PConst_string("listTo",(test/basicStructures.t/input.re[338,7919+46]..[338,7919+54]),None) + expression (test/basicStructures.t/input.re[338,7919+56]..[338,7919+70]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[338,7919+56]..[338,7919+70]) + Some + expression (test/basicStructures.t/input.re[338,7919+56]..[338,7919+70]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[338,7919+56]..[338,7919+64]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("append",(test/basicStructures.t/input.re[338,7919+56]..[338,7919+64]),None) + ] + Pexp_constant PConst_string("append",(test/basicStructures.t/input.re[338,7919+56]..[338,7919+64]),None) + expression (test/basicStructures.t/input.re[338,7919+66]..[338,7919+70]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[338,7919+66]..[338,7919+70]) + Some + expression (test/basicStructures.t/input.re[338,7919+66]..[338,7919+70]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[338,7919+66]..[338,7919+70]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("to",(test/basicStructures.t/input.re[338,7919+66]..[338,7919+70]),None) + ] + Pexp_constant PConst_string("to",(test/basicStructures.t/input.re[338,7919+66]..[338,7919+70]),None) + expression (test/basicStructures.t/input.re[338,7919+28]..[338,7919+70]) ghost + Pexp_construct "[]" (test/basicStructures.t/input.re[338,7919+28]..[338,7919+70]) ghost + None + ] + ] + ] + ] + core_type (test/basicStructures.t/input.re[338,7919+12]..[338,7919+24]) + Ptyp_constr "list" (test/basicStructures.t/input.re[338,7919+12]..[338,7919+16]) + [ + core_type (test/basicStructures.t/input.re[338,7919+17]..[338,7919+23]) + Ptyp_constr "string" (test/basicStructures.t/input.re[338,7919+17]..[338,7919+23]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[341,8041+0]..[343,8072+31]) ghost + Pstr_value Rec + [ + + pattern (test/basicStructures.t/input.re[341,8041+8]..[341,8041+12]) + Ppat_var "size" (test/basicStructures.t/input.re[341,8041+8]..[341,8041+12]) + expression (test/basicStructures.t/input.re[341,8041+15]..[343,8072+31]) + Pexp_function + [ + + pattern (test/basicStructures.t/input.re[342,8060+2]..[342,8060+6]) + Ppat_construct "[]" (test/basicStructures.t/input.re[342,8060+4]..[342,8060+6]) + None + expression (test/basicStructures.t/input.re[342,8060+10]..[342,8060+11]) + Pexp_constant PConst_int (0,None) + + pattern (test/basicStructures.t/input.re[343,8072+2]..[343,8072+15]) + Ppat_construct "::" (test/basicStructures.t/input.re[343,8072+5]..[343,8072+14]) + Some + [] + pattern (test/basicStructures.t/input.re[343,8072+5]..[343,8072+14]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[343,8072+5]..[343,8072+7]) + Ppat_var "hd" (test/basicStructures.t/input.re[343,8072+5]..[343,8072+7]) + pattern (test/basicStructures.t/input.re[343,8072+12]..[343,8072+14]) + Ppat_var "tl" (test/basicStructures.t/input.re[343,8072+12]..[343,8072+14]) + ] + expression (test/basicStructures.t/input.re[343,8072+19]..[343,8072+31]) + Pexp_apply + expression (test/basicStructures.t/input.re[343,8072+21]..[343,8072+22]) + Pexp_ident "+" (test/basicStructures.t/input.re[343,8072+21]..[343,8072+22]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[343,8072+19]..[343,8072+20]) + Pexp_constant PConst_int (1,None) + + Nolabel + expression (test/basicStructures.t/input.re[343,8072+23]..[343,8072+31]) + Pexp_apply + expression (test/basicStructures.t/input.re[343,8072+23]..[343,8072+27]) + Pexp_ident "size" (test/basicStructures.t/input.re[343,8072+23]..[343,8072+27]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[343,8072+28]..[343,8072+30]) + Pexp_ident "tl" (test/basicStructures.t/input.re[343,8072+28]..[343,8072+30]) + ] + ] + ] + ] + structure_item (test/basicStructures.t/input.re[346,8140+0]..[349,8238+1]) ghost + Pstr_value Rec + [ + + pattern (test/basicStructures.t/input.re[346,8140+8]..[346,8140+12]) + Ppat_var "size" (test/basicStructures.t/input.re[346,8140+8]..[346,8140+12]) + expression (test/basicStructures.t/input.re[346,8140+15]..[349,8238+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[346,8140+19]..[346,8140+24]) + Ppat_var "soFar" (test/basicStructures.t/input.re[346,8140+19]..[346,8140+24]) + expression (test/basicStructures.t/input.re[346,8140+25]..[349,8238+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[346,8140+25]..[346,8140+28]) + Ppat_var "lst" (test/basicStructures.t/input.re[346,8140+25]..[346,8140+28]) + expression (test/basicStructures.t/input.re[346,8140+33]..[349,8238+1]) + Pexp_match + expression (test/basicStructures.t/input.re[346,8140+40]..[346,8140+45]) + Pexp_ident "lst" (test/basicStructures.t/input.re[346,8140+41]..[346,8140+44]) + [ + + pattern (test/basicStructures.t/input.re[347,8188+2]..[347,8188+6]) + Ppat_construct "[]" (test/basicStructures.t/input.re[347,8188+4]..[347,8188+6]) + None + expression (test/basicStructures.t/input.re[347,8188+10]..[347,8188+11]) + Pexp_constant PConst_int (0,None) + + pattern (test/basicStructures.t/input.re[348,8200+2]..[348,8200+15]) + Ppat_construct "::" (test/basicStructures.t/input.re[348,8200+5]..[348,8200+14]) + Some + [] + pattern (test/basicStructures.t/input.re[348,8200+5]..[348,8200+14]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[348,8200+5]..[348,8200+7]) + Ppat_var "hd" (test/basicStructures.t/input.re[348,8200+5]..[348,8200+7]) + pattern (test/basicStructures.t/input.re[348,8200+12]..[348,8200+14]) + Ppat_var "tl" (test/basicStructures.t/input.re[348,8200+12]..[348,8200+14]) + ] + expression (test/basicStructures.t/input.re[348,8200+19]..[348,8200+37]) + Pexp_apply + expression (test/basicStructures.t/input.re[348,8200+19]..[348,8200+23]) + Pexp_ident "size" (test/basicStructures.t/input.re[348,8200+19]..[348,8200+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[348,8200+24]..[348,8200+33]) + Pexp_apply + expression (test/basicStructures.t/input.re[348,8200+30]..[348,8200+31]) + Pexp_ident "+" (test/basicStructures.t/input.re[348,8200+30]..[348,8200+31]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[348,8200+24]..[348,8200+29]) + Pexp_ident "soFar" (test/basicStructures.t/input.re[348,8200+24]..[348,8200+29]) + + Nolabel + expression (test/basicStructures.t/input.re[348,8200+32]..[348,8200+33]) + Pexp_constant PConst_int (1,None) + ] + + Nolabel + expression (test/basicStructures.t/input.re[348,8200+34]..[348,8200+36]) + Pexp_ident "tl" (test/basicStructures.t/input.re[348,8200+34]..[348,8200+36]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[351,8242+0]..[358,8423+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[351,8242+4]..[351,8242+15]) + Ppat_var "nestedMatch" (test/basicStructures.t/input.re[351,8242+4]..[351,8242+15]) + expression (test/basicStructures.t/input.re[351,8242+16]..[358,8423+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[351,8242+16]..[351,8242+22]) + Ppat_var "lstLst" (test/basicStructures.t/input.re[351,8242+16]..[351,8242+22]) + expression (test/basicStructures.t/input.re[351,8242+26]..[358,8423+1]) + Pexp_match + expression (test/basicStructures.t/input.re[351,8242+33]..[351,8242+41]) + Pexp_ident "lstLst" (test/basicStructures.t/input.re[351,8242+34]..[351,8242+40]) + [ + + pattern (test/basicStructures.t/input.re[352,8286+2]..[352,8286+15]) + Ppat_construct "::" (test/basicStructures.t/input.re[352,8286+5]..[352,8286+14]) + Some + [] + pattern (test/basicStructures.t/input.re[352,8286+5]..[352,8286+14]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[352,8286+5]..[352,8286+7]) + Ppat_var "hd" (test/basicStructures.t/input.re[352,8286+5]..[352,8286+7]) + pattern (test/basicStructures.t/input.re[352,8286+12]..[352,8286+14]) + Ppat_var "tl" (test/basicStructures.t/input.re[352,8286+12]..[352,8286+14]) + ] + + expression (test/basicStructures.t/input.re[352,8286+21]..[352,8286+26]) + Pexp_construct "false" (test/basicStructures.t/input.re[352,8286+21]..[352,8286+26]) + None + expression (test/basicStructures.t/input.re[352,8286+30]..[352,8286+32]) + Pexp_constant PConst_int (10,None) + + pattern (test/basicStructures.t/input.re[353,8319+2]..[353,8319+15]) + Ppat_construct "::" (test/basicStructures.t/input.re[353,8319+5]..[353,8319+14]) + Some + [] + pattern (test/basicStructures.t/input.re[353,8319+5]..[353,8319+14]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[353,8319+5]..[353,8319+7]) + Ppat_var "hd" (test/basicStructures.t/input.re[353,8319+5]..[353,8319+7]) + pattern (test/basicStructures.t/input.re[353,8319+12]..[353,8319+14]) + Ppat_var "tl" (test/basicStructures.t/input.re[353,8319+12]..[353,8319+14]) + ] + expression (test/basicStructures.t/input.re[353,8319+19]..[356,8405+5]) + Pexp_match + expression (test/basicStructures.t/input.re[353,8319+26]..[353,8319+30]) + Pexp_ident "tl" (test/basicStructures.t/input.re[353,8319+27]..[353,8319+29]) + [ + + pattern (test/basicStructures.t/input.re[354,8352+6]..[354,8352+10]) + Ppat_construct "[]" (test/basicStructures.t/input.re[354,8352+8]..[354,8352+10]) + None + expression (test/basicStructures.t/input.re[354,8352+14]..[354,8352+19]) + Pexp_apply + expression (test/basicStructures.t/input.re[354,8352+16]..[354,8352+17]) + Pexp_ident "+" (test/basicStructures.t/input.re[354,8352+16]..[354,8352+17]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[354,8352+14]..[354,8352+15]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[354,8352+18]..[354,8352+19]) + Pexp_constant PConst_int (0,None) + ] + + pattern (test/basicStructures.t/input.re[355,8372+6]..[355,8372+23]) + Ppat_construct "::" (test/basicStructures.t/input.re[355,8372+9]..[355,8372+22]) + Some + [] + pattern (test/basicStructures.t/input.re[355,8372+9]..[355,8372+22]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[355,8372+9]..[355,8372+13]) + Ppat_var "tlHd" (test/basicStructures.t/input.re[355,8372+9]..[355,8372+13]) + pattern (test/basicStructures.t/input.re[355,8372+18]..[355,8372+22]) + Ppat_var "tlTl" (test/basicStructures.t/input.re[355,8372+18]..[355,8372+22]) + ] + expression (test/basicStructures.t/input.re[355,8372+27]..[355,8372+32]) + Pexp_apply + expression (test/basicStructures.t/input.re[355,8372+29]..[355,8372+30]) + Pexp_ident "+" (test/basicStructures.t/input.re[355,8372+29]..[355,8372+30]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[355,8372+27]..[355,8372+28]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[355,8372+31]..[355,8372+32]) + Pexp_constant PConst_int (1,None) + ] + ] + + pattern (test/basicStructures.t/input.re[357,8411+2]..[357,8411+6]) + Ppat_construct "[]" (test/basicStructures.t/input.re[357,8411+4]..[357,8411+6]) + None + expression (test/basicStructures.t/input.re[357,8411+10]..[357,8411+11]) + Pexp_constant PConst_int (0,None) + ] + ] + structure_item (test/basicStructures.t/input.re[360,8427+0]..[368,8667+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[360,8427+4]..[360,8427+23]) + Ppat_var "nestedMatchWithWhen" (test/basicStructures.t/input.re[360,8427+4]..[360,8427+23]) + expression (test/basicStructures.t/input.re[360,8427+24]..[368,8667+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[360,8427+24]..[360,8427+30]) + Ppat_var "lstLst" (test/basicStructures.t/input.re[360,8427+24]..[360,8427+30]) + expression (test/basicStructures.t/input.re[360,8427+34]..[368,8667+1]) + Pexp_match + expression (test/basicStructures.t/input.re[360,8427+41]..[360,8427+49]) + Pexp_ident "lstLst" (test/basicStructures.t/input.re[360,8427+42]..[360,8427+48]) + [ + + pattern (test/basicStructures.t/input.re[361,8479+2]..[361,8479+15]) + Ppat_construct "::" (test/basicStructures.t/input.re[361,8479+5]..[361,8479+14]) + Some + [] + pattern (test/basicStructures.t/input.re[361,8479+5]..[361,8479+14]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[361,8479+5]..[361,8479+7]) + Ppat_var "hd" (test/basicStructures.t/input.re[361,8479+5]..[361,8479+7]) + pattern (test/basicStructures.t/input.re[361,8479+12]..[361,8479+14]) + Ppat_var "tl" (test/basicStructures.t/input.re[361,8479+12]..[361,8479+14]) + ] + + expression (test/basicStructures.t/input.re[361,8479+21]..[361,8479+26]) + Pexp_construct "false" (test/basicStructures.t/input.re[361,8479+21]..[361,8479+26]) + None + expression (test/basicStructures.t/input.re[361,8479+30]..[361,8479+32]) + Pexp_constant PConst_int (10,None) + + pattern (test/basicStructures.t/input.re[362,8512+2]..[362,8512+15]) + Ppat_construct "::" (test/basicStructures.t/input.re[362,8512+5]..[362,8512+14]) + Some + [] + pattern (test/basicStructures.t/input.re[362,8512+5]..[362,8512+14]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[362,8512+5]..[362,8512+7]) + Ppat_var "hd" (test/basicStructures.t/input.re[362,8512+5]..[362,8512+7]) + pattern (test/basicStructures.t/input.re[362,8512+12]..[362,8512+14]) + Ppat_var "tl" (test/basicStructures.t/input.re[362,8512+12]..[362,8512+14]) + ] + + expression (test/basicStructures.t/input.re[362,8512+21]..[362,8512+25]) + Pexp_construct "true" (test/basicStructures.t/input.re[362,8512+21]..[362,8512+25]) + None + expression (test/basicStructures.t/input.re[362,8512+29]..[366,8649+5]) + Pexp_match + expression (test/basicStructures.t/input.re[362,8512+36]..[362,8512+40]) + Pexp_ident "tl" (test/basicStructures.t/input.re[362,8512+37]..[362,8512+39]) + [ + + pattern (test/basicStructures.t/input.re[363,8555+6]..[363,8555+10]) + Ppat_construct "[]" (test/basicStructures.t/input.re[363,8555+8]..[363,8555+10]) + None + + expression (test/basicStructures.t/input.re[363,8555+16]..[363,8555+21]) + Pexp_construct "false" (test/basicStructures.t/input.re[363,8555+16]..[363,8555+21]) + None + expression (test/basicStructures.t/input.re[363,8555+25]..[363,8555+30]) + Pexp_apply + expression (test/basicStructures.t/input.re[363,8555+27]..[363,8555+28]) + Pexp_ident "+" (test/basicStructures.t/input.re[363,8555+27]..[363,8555+28]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[363,8555+25]..[363,8555+26]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[363,8555+29]..[363,8555+30]) + Pexp_constant PConst_int (0,None) + ] + + pattern (test/basicStructures.t/input.re[364,8586+6]..[364,8586+10]) + Ppat_construct "[]" (test/basicStructures.t/input.re[364,8586+8]..[364,8586+10]) + None + + expression (test/basicStructures.t/input.re[364,8586+16]..[364,8586+20]) + Pexp_construct "true" (test/basicStructures.t/input.re[364,8586+16]..[364,8586+20]) + None + expression (test/basicStructures.t/input.re[364,8586+24]..[364,8586+29]) + Pexp_apply + expression (test/basicStructures.t/input.re[364,8586+26]..[364,8586+27]) + Pexp_ident "+" (test/basicStructures.t/input.re[364,8586+26]..[364,8586+27]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[364,8586+24]..[364,8586+25]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[364,8586+28]..[364,8586+29]) + Pexp_constant PConst_int (0,None) + ] + + pattern (test/basicStructures.t/input.re[365,8616+6]..[365,8616+23]) + Ppat_construct "::" (test/basicStructures.t/input.re[365,8616+9]..[365,8616+22]) + Some + [] + pattern (test/basicStructures.t/input.re[365,8616+9]..[365,8616+22]) ghost + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[365,8616+9]..[365,8616+13]) + Ppat_var "tlHd" (test/basicStructures.t/input.re[365,8616+9]..[365,8616+13]) + pattern (test/basicStructures.t/input.re[365,8616+18]..[365,8616+22]) + Ppat_var "tlTl" (test/basicStructures.t/input.re[365,8616+18]..[365,8616+22]) + ] + expression (test/basicStructures.t/input.re[365,8616+27]..[365,8616+32]) + Pexp_apply + expression (test/basicStructures.t/input.re[365,8616+29]..[365,8616+30]) + Pexp_ident "+" (test/basicStructures.t/input.re[365,8616+29]..[365,8616+30]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[365,8616+27]..[365,8616+28]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[365,8616+31]..[365,8616+32]) + Pexp_constant PConst_int (1,None) + ] + ] + + pattern (test/basicStructures.t/input.re[367,8655+2]..[367,8655+6]) + Ppat_construct "[]" (test/basicStructures.t/input.re[367,8655+4]..[367,8655+6]) + None + expression (test/basicStructures.t/input.re[367,8655+10]..[367,8655+11]) + Pexp_constant PConst_int (0,None) + ] + ] + structure_item (test/basicStructures.t/input.re[371,8672+0]..[373,8714+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[371,8672+0]..[373,8714+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[371,8672+0]..[373,8714+3]) + Pexp_constant PConst_string("\n * Aliasing with \"as\" during matches.\n ",(test/basicStructures.t/input.re[371,8672+0]..[373,8714+3]),None) + ] + structure_item (test/basicStructures.t/input.re[374,8719+0]..[374,8719+41]) + Pstr_type Rec + [ + type_declaration "mine" (test/basicStructures.t/input.re[374,8719+5]..[374,8719+9]) (test/basicStructures.t/input.re[374,8719+0]..[374,8719+41]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_variant + [ + (test/basicStructures.t/input.re[374,8719+12]..[374,8719+24]) + "MyThing" (test/basicStructures.t/input.re[374,8719+12]..[374,8719+19]) + [ + core_type (test/basicStructures.t/input.re[374,8719+20]..[374,8719+23]) + Ptyp_constr "int" (test/basicStructures.t/input.re[374,8719+20]..[374,8719+23]) + [] + ] + None + (test/basicStructures.t/input.re[374,8719+27]..[374,8719+41]) + "YourThing" (test/basicStructures.t/input.re[374,8719+27]..[374,8719+36]) + [ + core_type (test/basicStructures.t/input.re[374,8719+37]..[374,8719+40]) + Ptyp_constr "int" (test/basicStructures.t/input.re[374,8719+37]..[374,8719+40]) + [] + ] + None + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[378,8823+0]..[381,8909+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[378,8823+4]..[378,8823+7]) + Ppat_var "ppp" (test/basicStructures.t/input.re[378,8823+4]..[378,8823+7]) + expression (test/basicStructures.t/input.re[378,8823+10]..[381,8909+1]) + Pexp_match + expression (test/basicStructures.t/input.re[378,8823+17]..[378,8823+30]) + attribute "explicit_arity" + [] + Pexp_construct "MyThing" (test/basicStructures.t/input.re[378,8823+18]..[378,8823+25]) + Some + expression (test/basicStructures.t/input.re[378,8823+25]..[378,8823+29]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[378,8823+26]..[378,8823+28]) + Pexp_constant PConst_int (20,None) + ] + [ + + pattern (test/basicStructures.t/input.re[379,8856+2]..[380,8878+23]) + Ppat_or + pattern (test/basicStructures.t/input.re[379,8856+4]..[379,8856+21]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[379,8856+18]..[379,8856+21]) + pattern (test/basicStructures.t/input.re[379,8856+4]..[379,8856+14]) + attribute "explicit_arity" + [] + Ppat_construct "MyThing" (test/basicStructures.t/input.re[379,8856+4]..[379,8856+11]) + Some + [] + pattern (test/basicStructures.t/input.re[379,8856+4]..[379,8856+14]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[379,8856+12]..[379,8856+13]) + Ppat_var "x" (test/basicStructures.t/input.re[379,8856+12]..[379,8856+13]) + ] + pattern (test/basicStructures.t/input.re[380,8878+4]..[380,8878+23]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[380,8878+20]..[380,8878+23]) + pattern (test/basicStructures.t/input.re[380,8878+4]..[380,8878+16]) + attribute "explicit_arity" + [] + Ppat_construct "YourThing" (test/basicStructures.t/input.re[380,8878+4]..[380,8878+13]) + Some + [] + pattern (test/basicStructures.t/input.re[380,8878+4]..[380,8878+16]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[380,8878+14]..[380,8878+15]) + Ppat_var "x" (test/basicStructures.t/input.re[380,8878+14]..[380,8878+15]) + ] + expression (test/basicStructures.t/input.re[380,8878+27]..[380,8878+30]) + Pexp_ident "ppp" (test/basicStructures.t/input.re[380,8878+27]..[380,8878+30]) + ] + ] + structure_item (test/basicStructures.t/input.re[383,8913+0]..[383,8913+49]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[383,8913+4]..[383,8913+43]) + Ppat_or + pattern (test/basicStructures.t/input.re[383,8913+4]..[383,8913+21]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[383,8913+18]..[383,8913+21]) + pattern (test/basicStructures.t/input.re[383,8913+4]..[383,8913+14]) + Ppat_construct "MyThing" (test/basicStructures.t/input.re[383,8913+4]..[383,8913+11]) + Some + [] + pattern (test/basicStructures.t/input.re[383,8913+12]..[383,8913+13]) + Ppat_any + pattern (test/basicStructures.t/input.re[383,8913+24]..[383,8913+43]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[383,8913+40]..[383,8913+43]) + pattern (test/basicStructures.t/input.re[383,8913+24]..[383,8913+36]) + Ppat_construct "YourThing" (test/basicStructures.t/input.re[383,8913+24]..[383,8913+33]) + Some + [] + pattern (test/basicStructures.t/input.re[383,8913+34]..[383,8913+35]) + Ppat_any + expression (test/basicStructures.t/input.re[383,8913+46]..[383,8913+49]) + Pexp_ident "ppp" (test/basicStructures.t/input.re[383,8913+46]..[383,8913+49]) + ] + structure_item (test/basicStructures.t/input.re[389,9057+0]..[392,9147+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[389,9057+4]..[389,9057+7]) + Ppat_var "ppp" (test/basicStructures.t/input.re[389,9057+4]..[389,9057+7]) + expression (test/basicStructures.t/input.re[389,9057+10]..[392,9147+1]) + Pexp_match + expression (test/basicStructures.t/input.re[389,9057+17]..[389,9057+30]) + attribute "explicit_arity" + [] + Pexp_construct "MyThing" (test/basicStructures.t/input.re[389,9057+18]..[389,9057+25]) + Some + expression (test/basicStructures.t/input.re[389,9057+25]..[389,9057+29]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[389,9057+26]..[389,9057+28]) + Pexp_constant PConst_int (20,None) + ] + [ + + pattern (test/basicStructures.t/input.re[390,9090+2]..[391,9114+25]) + Ppat_or + pattern (test/basicStructures.t/input.re[390,9090+4]..[390,9090+23]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[390,9090+19]..[390,9090+22]) + pattern (test/basicStructures.t/input.re[390,9090+5]..[390,9090+15]) + attribute "explicit_arity" + [] + Ppat_construct "MyThing" (test/basicStructures.t/input.re[390,9090+5]..[390,9090+12]) + Some + [] + pattern (test/basicStructures.t/input.re[390,9090+5]..[390,9090+15]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[390,9090+13]..[390,9090+14]) + Ppat_var "x" (test/basicStructures.t/input.re[390,9090+13]..[390,9090+14]) + ] + pattern (test/basicStructures.t/input.re[391,9114+4]..[391,9114+25]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[391,9114+21]..[391,9114+24]) + pattern (test/basicStructures.t/input.re[391,9114+5]..[391,9114+17]) + attribute "explicit_arity" + [] + Ppat_construct "YourThing" (test/basicStructures.t/input.re[391,9114+5]..[391,9114+14]) + Some + [] + pattern (test/basicStructures.t/input.re[391,9114+5]..[391,9114+17]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[391,9114+15]..[391,9114+16]) + Ppat_var "x" (test/basicStructures.t/input.re[391,9114+15]..[391,9114+16]) + ] + expression (test/basicStructures.t/input.re[391,9114+29]..[391,9114+32]) + Pexp_ident "ppp" (test/basicStructures.t/input.re[391,9114+29]..[391,9114+32]) + ] + ] + structure_item (test/basicStructures.t/input.re[394,9151+0]..[394,9151+52]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[394,9151+4]..[394,9151+46]) + Ppat_or + pattern (test/basicStructures.t/input.re[394,9151+4]..[394,9151+23]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[394,9151+19]..[394,9151+22]) + pattern (test/basicStructures.t/input.re[394,9151+5]..[394,9151+15]) + Ppat_construct "MyThing" (test/basicStructures.t/input.re[394,9151+5]..[394,9151+12]) + Some + [] + pattern (test/basicStructures.t/input.re[394,9151+13]..[394,9151+14]) + Ppat_any + pattern (test/basicStructures.t/input.re[394,9151+25]..[394,9151+46]) + Ppat_alias "ppp" (test/basicStructures.t/input.re[394,9151+42]..[394,9151+45]) + pattern (test/basicStructures.t/input.re[394,9151+26]..[394,9151+38]) + Ppat_construct "YourThing" (test/basicStructures.t/input.re[394,9151+26]..[394,9151+35]) + Some + [] + pattern (test/basicStructures.t/input.re[394,9151+36]..[394,9151+37]) + Ppat_any + expression (test/basicStructures.t/input.re[394,9151+49]..[394,9151+52]) + Pexp_ident "ppp" (test/basicStructures.t/input.re[394,9151+49]..[394,9151+52]) + ] + structure_item (test/basicStructures.t/input.re[413,9542+0]..[418,9893+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[413,9542+0]..[418,9893+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[413,9542+0]..[418,9893+3]) + Pexp_constant PConst_string(" ARRAYS\n * ============================================================================\n * Arrays are weird looking. Usually you want lists because they support pattern\n * matching - that's why they have nicer syntax - to entice you. But if you want\n * random access and better control over memory layout, use arrays.\n ",(test/basicStructures.t/input.re[413,9542+0]..[418,9893+3]),None) + ] + structure_item (test/basicStructures.t/input.re[419,9898+0]..[419,9898+21]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[419,9898+4]..[419,9898+14]) + Ppat_var "emptyArray" (test/basicStructures.t/input.re[419,9898+4]..[419,9898+14]) + expression (test/basicStructures.t/input.re[419,9898+17]..[419,9898+21]) + Pexp_array + [] + ] + structure_item (test/basicStructures.t/input.re[420,9921+0]..[420,9921+25]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[420,9921+4]..[420,9921+16]) + Ppat_var "arrayWithOne" (test/basicStructures.t/input.re[420,9921+4]..[420,9921+16]) + expression (test/basicStructures.t/input.re[420,9921+19]..[420,9921+25]) + Pexp_array + [ + expression (test/basicStructures.t/input.re[420,9921+21]..[420,9921+23]) + Pexp_constant PConst_int (10,None) + ] + ] + structure_item (test/basicStructures.t/input.re[421,9948+0]..[421,9948+29]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[421,9948+4]..[421,9948+16]) + Ppat_var "arrayWithTwo" (test/basicStructures.t/input.re[421,9948+4]..[421,9948+16]) + expression (test/basicStructures.t/input.re[421,9948+19]..[421,9948+29]) + Pexp_array + [ + expression (test/basicStructures.t/input.re[421,9948+21]..[421,9948+23]) + Pexp_constant PConst_int (10,None) + expression (test/basicStructures.t/input.re[421,9948+25]..[421,9948+27]) + Pexp_constant PConst_int (10,None) + ] + ] + structure_item (test/basicStructures.t/input.re[422,9979+0]..[422,9979+42]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[422,9979+4]..[422,9979+14]) + Ppat_var "secondItem" (test/basicStructures.t/input.re[422,9979+4]..[422,9979+14]) + expression (test/basicStructures.t/input.re[422,9979+17]..[422,9979+42]) + Pexp_apply + expression (test/basicStructures.t/input.re[422,9979+17]..[422,9979+26]) + Pexp_ident "Array.get" (test/basicStructures.t/input.re[422,9979+17]..[422,9979+26]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[422,9979+27]..[422,9979+39]) + Pexp_ident "arrayWithTwo" (test/basicStructures.t/input.re[422,9979+27]..[422,9979+39]) + + Nolabel + expression (test/basicStructures.t/input.re[422,9979+40]..[422,9979+41]) + Pexp_constant PConst_int (1,None) + ] + ] + structure_item (test/basicStructures.t/input.re[426,10121+0]..[426,10121+32]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[426,10121+4]..[426,10121+14]) + Ppat_var "secondItem" (test/basicStructures.t/input.re[426,10121+4]..[426,10121+14]) + expression (test/basicStructures.t/input.re[426,10121+17]..[426,10121+32]) + Pexp_apply + expression (test/basicStructures.t/input.re[426,10121+17]..[426,10121+32]) ghost + Pexp_ident "Array.get" (test/basicStructures.t/input.re[426,10121+17]..[426,10121+32]) ghost + [ + + Nolabel + expression (test/basicStructures.t/input.re[426,10121+17]..[426,10121+29]) + Pexp_ident "arrayWithTwo" (test/basicStructures.t/input.re[426,10121+17]..[426,10121+29]) + + Nolabel + expression (test/basicStructures.t/input.re[426,10121+30]..[426,10121+31]) + Pexp_constant PConst_int (1,None) + ] + ] + structure_item (test/basicStructures.t/input.re[428,10190+0]..[428,10190+21]) + Pstr_eval + expression (test/basicStructures.t/input.re[428,10190+0]..[428,10190+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[428,10190+0]..[428,10190+21]) ghost + Pexp_ident "Array.set" (test/basicStructures.t/input.re[428,10190+0]..[428,10190+21]) ghost + [ + + Nolabel + expression (test/basicStructures.t/input.re[428,10190+0]..[428,10190+12]) + Pexp_ident "arrayWithTwo" (test/basicStructures.t/input.re[428,10190+0]..[428,10190+12]) + + Nolabel + expression (test/basicStructures.t/input.re[428,10190+13]..[428,10190+14]) + Pexp_constant PConst_int (1,None) + + Nolabel + expression (test/basicStructures.t/input.re[428,10190+18]..[428,10190+21]) + Pexp_constant PConst_int (300,None) + ] + structure_item (test/basicStructures.t/input.re[431,10215+0]..[435,10424+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[431,10215+0]..[435,10424+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[431,10215+0]..[435,10424+3]) + Pexp_constant PConst_string("\n * STRINGS\n * ============================================================================\n * The language supports mutating strings, but that should not be depended upon.\n ",(test/basicStructures.t/input.re[431,10215+0]..[435,10424+3]),None) + ] + structure_item (test/basicStructures.t/input.re[436,10429+0]..[436,10429+21]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[436,10429+4]..[436,10429+12]) + Ppat_var "myString" (test/basicStructures.t/input.re[436,10429+4]..[436,10429+12]) + expression (test/basicStructures.t/input.re[436,10429+15]..[436,10429+21]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("asdf",(test/basicStructures.t/input.re[436,10429+15]..[436,10429+21]),None) + ] + Pexp_constant PConst_string("asdf",(test/basicStructures.t/input.re[436,10429+15]..[436,10429+21]),None) + ] + structure_item (test/basicStructures.t/input.re[437,10452+0]..[437,10452+18]) + Pstr_eval + expression (test/basicStructures.t/input.re[437,10452+0]..[437,10452+18]) + Pexp_apply + expression (test/basicStructures.t/input.re[437,10452+0]..[437,10452+18]) ghost + Pexp_ident "String.set" (test/basicStructures.t/input.re[437,10452+0]..[437,10452+18]) ghost + [ + + Nolabel + expression (test/basicStructures.t/input.re[437,10452+0]..[437,10452+8]) + Pexp_ident "myString" (test/basicStructures.t/input.re[437,10452+0]..[437,10452+8]) + + Nolabel + expression (test/basicStructures.t/input.re[437,10452+10]..[437,10452+11]) + Pexp_constant PConst_int (2,None) + + Nolabel + expression (test/basicStructures.t/input.re[437,10452+15]..[437,10452+18]) + Pexp_constant PConst_char 39 + ] + structure_item (test/basicStructures.t/input.re[454,10795+0]..[454,10795+13]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[454,10795+4]..[454,10795+7]) + Ppat_var "one" (test/basicStructures.t/input.re[454,10795+4]..[454,10795+7]) + expression (test/basicStructures.t/input.re[454,10795+10]..[454,10795+13]) + Pexp_constant PConst_int (900,None) + ] + structure_item (test/basicStructures.t/input.re[455,10810+0]..[455,10810+15]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[455,10810+4]..[455,10810+7]) + Ppat_var "two" (test/basicStructures.t/input.re[455,10810+4]..[455,10810+7]) + expression (test/basicStructures.t/input.re[455,10810+10]..[455,10810+15]) + Pexp_constant PConst_int (10000,None) + ] + structure_item (test/basicStructures.t/input.re[457,10902+0]..[457,10902+32]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[457,10902+4]..[457,10902+11]) + Ppat_var "myTuple" (test/basicStructures.t/input.re[457,10902+4]..[457,10902+11]) + expression (test/basicStructures.t/input.re[457,10902+14]..[457,10902+32]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[457,10902+15]..[457,10902+22]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[457,10902+15]..[457,10902+18]) + Pexp_ident "one" (test/basicStructures.t/input.re[457,10902+15]..[457,10902+18]) + core_type (test/basicStructures.t/input.re[457,10902+19]..[457,10902+22]) + Ptyp_constr "int" (test/basicStructures.t/input.re[457,10902+19]..[457,10902+22]) + [] + expression (test/basicStructures.t/input.re[457,10902+24]..[457,10902+31]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[457,10902+24]..[457,10902+27]) + Pexp_ident "two" (test/basicStructures.t/input.re[457,10902+24]..[457,10902+27]) + core_type (test/basicStructures.t/input.re[457,10902+28]..[457,10902+31]) + Ptyp_constr "int" (test/basicStructures.t/input.re[457,10902+28]..[457,10902+31]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[458,10936+0]..[458,10936+29]) + Pstr_type Rec + [ + type_declaration "myTupleType" (test/basicStructures.t/input.re[458,10936+5]..[458,10936+16]) (test/basicStructures.t/input.re[458,10936+0]..[458,10936+29]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_abstract + ptype_private = Public + ptype_manifest = + Some + core_type (test/basicStructures.t/input.re[458,10936+19]..[458,10936+29]) + Ptyp_tuple + [ + core_type (test/basicStructures.t/input.re[458,10936+20]..[458,10936+23]) + Ptyp_constr "int" (test/basicStructures.t/input.re[458,10936+20]..[458,10936+23]) + [] + core_type (test/basicStructures.t/input.re[458,10936+25]..[458,10936+28]) + Ptyp_constr "int" (test/basicStructures.t/input.re[458,10936+25]..[458,10936+28]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[459,10967+0]..[459,10967+35]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[459,10967+4]..[459,10967+11]) + Ppat_var "myTuple" (test/basicStructures.t/input.re[459,10967+4]..[459,10967+11]) + expression (test/basicStructures.t/input.re[459,10967+14]..[459,10967+35]) + Pexp_constraint + expression (test/basicStructures.t/input.re[459,10967+15]..[459,10967+22]) + Pexp_ident "myTuple" (test/basicStructures.t/input.re[459,10967+15]..[459,10967+22]) + core_type (test/basicStructures.t/input.re[459,10967+23]..[459,10967+34]) + Ptyp_constr "myTupleType" (test/basicStructures.t/input.re[459,10967+23]..[459,10967+34]) + [] + ] + structure_item (test/basicStructures.t/input.re[462,11081+0]..[462,11081+46]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[462,11081+4]..[462,11081+11]) + Ppat_var "myTuple" (test/basicStructures.t/input.re[462,11081+4]..[462,11081+11]) + expression (test/basicStructures.t/input.re[462,11081+14]..[462,11081+46]) + Pexp_constraint + expression (test/basicStructures.t/input.re[462,11081+15]..[462,11081+33]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[462,11081+16]..[462,11081+23]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[462,11081+16]..[462,11081+19]) + Pexp_ident "one" (test/basicStructures.t/input.re[462,11081+16]..[462,11081+19]) + core_type (test/basicStructures.t/input.re[462,11081+20]..[462,11081+23]) + Ptyp_constr "int" (test/basicStructures.t/input.re[462,11081+20]..[462,11081+23]) + [] + expression (test/basicStructures.t/input.re[462,11081+25]..[462,11081+32]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[462,11081+25]..[462,11081+28]) + Pexp_ident "two" (test/basicStructures.t/input.re[462,11081+25]..[462,11081+28]) + core_type (test/basicStructures.t/input.re[462,11081+29]..[462,11081+32]) + Ptyp_constr "int" (test/basicStructures.t/input.re[462,11081+29]..[462,11081+32]) + [] + ] + core_type (test/basicStructures.t/input.re[462,11081+34]..[462,11081+45]) + Ptyp_constr "myTupleType" (test/basicStructures.t/input.re[462,11081+34]..[462,11081+45]) + [] + ] + structure_item (test/basicStructures.t/input.re[465,11208+0]..[467,11257+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[465,11208+4]..[465,11208+13]) + Ppat_var "addValues" (test/basicStructures.t/input.re[465,11208+4]..[465,11208+13]) + expression (test/basicStructures.t/input.re[465,11208+16]..[467,11257+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[465,11208+21]..[465,11208+26]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[465,11208+21]..[465,11208+22]) + Ppat_var "a" (test/basicStructures.t/input.re[465,11208+21]..[465,11208+22]) + core_type (test/basicStructures.t/input.re[465,11208+23]..[465,11208+26]) + Ptyp_constr "int" (test/basicStructures.t/input.re[465,11208+23]..[465,11208+26]) + [] + expression (test/basicStructures.t/input.re[465,11208+28]..[467,11257+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[465,11208+28]..[465,11208+33]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[465,11208+28]..[465,11208+29]) + Ppat_var "b" (test/basicStructures.t/input.re[465,11208+28]..[465,11208+29]) + core_type (test/basicStructures.t/input.re[465,11208+30]..[465,11208+33]) + Ptyp_constr "int" (test/basicStructures.t/input.re[465,11208+30]..[465,11208+33]) + [] + expression (test/basicStructures.t/input.re[465,11208+38]..[467,11257+1]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[466,11248+4]..[466,11248+5]) + Pexp_ident "+" (test/basicStructures.t/input.re[466,11248+4]..[466,11248+5]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[466,11248+2]..[466,11248+3]) + Pexp_ident "a" (test/basicStructures.t/input.re[466,11248+2]..[466,11248+3]) + + Nolabel + expression (test/basicStructures.t/input.re[466,11248+6]..[466,11248+7]) + Pexp_ident "b" (test/basicStructures.t/input.re[466,11248+6]..[466,11248+7]) + ] + ] + structure_item (test/basicStructures.t/input.re[469,11261+0]..[471,11310+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[469,11261+4]..[469,11261+13]) + Ppat_var "addValues" (test/basicStructures.t/input.re[469,11261+4]..[469,11261+13]) + expression (test/basicStructures.t/input.re[469,11261+16]..[471,11310+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[469,11261+21]..[469,11261+26]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[469,11261+21]..[469,11261+22]) + Ppat_var "a" (test/basicStructures.t/input.re[469,11261+21]..[469,11261+22]) + core_type (test/basicStructures.t/input.re[469,11261+23]..[469,11261+26]) + Ptyp_constr "int" (test/basicStructures.t/input.re[469,11261+23]..[469,11261+26]) + [] + expression (test/basicStructures.t/input.re[469,11261+28]..[471,11310+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[469,11261+28]..[469,11261+33]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[469,11261+28]..[469,11261+29]) + Ppat_var "b" (test/basicStructures.t/input.re[469,11261+28]..[469,11261+29]) + core_type (test/basicStructures.t/input.re[469,11261+30]..[469,11261+33]) + Ptyp_constr "int" (test/basicStructures.t/input.re[469,11261+30]..[469,11261+33]) + [] + expression (test/basicStructures.t/input.re[469,11261+38]..[471,11310+1]) + attribute "reason.preserve_braces" + [] + Pexp_apply + expression (test/basicStructures.t/input.re[470,11301+4]..[470,11301+5]) + Pexp_ident "+" (test/basicStructures.t/input.re[470,11301+4]..[470,11301+5]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[470,11301+2]..[470,11301+3]) + Pexp_ident "a" (test/basicStructures.t/input.re[470,11301+2]..[470,11301+3]) + + Nolabel + expression (test/basicStructures.t/input.re[470,11301+6]..[470,11301+7]) + Pexp_ident "b" (test/basicStructures.t/input.re[470,11301+6]..[470,11301+7]) + ] + ] + structure_item (test/basicStructures.t/input.re[473,11314+0]..[473,11314+54]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[473,11314+4]..[473,11314+14]) + Ppat_var "myFunction" (test/basicStructures.t/input.re[473,11314+4]..[473,11314+14]) + expression (test/basicStructures.t/input.re[473,11314+17]..[473,11314+54]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[473,11314+22]..[473,11314+29]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[473,11314+22]..[473,11314+23]) + Ppat_var "a" (test/basicStructures.t/input.re[473,11314+22]..[473,11314+23]) + core_type (test/basicStructures.t/input.re[473,11314+26]..[473,11314+29]) + Ptyp_constr "int" (test/basicStructures.t/input.re[473,11314+26]..[473,11314+29]) + [] + expression (test/basicStructures.t/input.re[473,11314+31]..[473,11314+54]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[473,11314+31]..[473,11314+38]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[473,11314+31]..[473,11314+32]) + Ppat_var "b" (test/basicStructures.t/input.re[473,11314+31]..[473,11314+32]) + core_type (test/basicStructures.t/input.re[473,11314+35]..[473,11314+38]) + Ptyp_constr "int" (test/basicStructures.t/input.re[473,11314+35]..[473,11314+38]) + [] + expression (test/basicStructures.t/input.re[473,11314+21]..[473,11314+54]) + Pexp_constraint + expression (test/basicStructures.t/input.re[473,11314+49]..[473,11314+54]) + Pexp_apply + expression (test/basicStructures.t/input.re[473,11314+51]..[473,11314+52]) + Pexp_ident "+" (test/basicStructures.t/input.re[473,11314+51]..[473,11314+52]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[473,11314+49]..[473,11314+50]) + Pexp_ident "a" (test/basicStructures.t/input.re[473,11314+49]..[473,11314+50]) + + Nolabel + expression (test/basicStructures.t/input.re[473,11314+53]..[473,11314+54]) + Pexp_ident "b" (test/basicStructures.t/input.re[473,11314+53]..[473,11314+54]) + ] + core_type (test/basicStructures.t/input.re[473,11314+42]..[473,11314+45]) + Ptyp_constr "int" (test/basicStructures.t/input.re[473,11314+42]..[473,11314+45]) + [] + ] + structure_item (test/basicStructures.t/input.re[475,11371+0]..[475,11371+77]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[475,11371+4]..[475,11371+27]) + Ppat_var "functionReturnValueType" (test/basicStructures.t/input.re[475,11371+4]..[475,11371+27]) + expression (test/basicStructures.t/input.re[475,11371+29]..[475,11371+77]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[475,11371+29]..[475,11371+34]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[475,11371+29]..[475,11371+30]) + Ppat_var "i" (test/basicStructures.t/input.re[475,11371+29]..[475,11371+30]) + core_type (test/basicStructures.t/input.re[475,11371+31]..[475,11371+34]) + Ptyp_constr "int" (test/basicStructures.t/input.re[475,11371+31]..[475,11371+34]) + [] + expression (test/basicStructures.t/input.re[475,11371+36]..[475,11371+77]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[475,11371+36]..[475,11371+44]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[475,11371+36]..[475,11371+37]) + Ppat_var "s" (test/basicStructures.t/input.re[475,11371+36]..[475,11371+37]) + core_type (test/basicStructures.t/input.re[475,11371+38]..[475,11371+44]) + Ptyp_constr "string" (test/basicStructures.t/input.re[475,11371+38]..[475,11371+44]) + [] + expression (test/basicStructures.t/input.re[475,11371+28]..[475,11371+77]) + Pexp_constraint + expression (test/basicStructures.t/input.re[475,11371+62]..[475,11371+77]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[475,11371+66]..[475,11371+67]) + Ppat_var "x" (test/basicStructures.t/input.re[475,11371+66]..[475,11371+67]) + expression (test/basicStructures.t/input.re[475,11371+72]..[475,11371+77]) + Pexp_apply + expression (test/basicStructures.t/input.re[475,11371+74]..[475,11371+75]) + Pexp_ident "+" (test/basicStructures.t/input.re[475,11371+74]..[475,11371+75]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[475,11371+72]..[475,11371+73]) + Pexp_ident "x" (test/basicStructures.t/input.re[475,11371+72]..[475,11371+73]) + + Nolabel + expression (test/basicStructures.t/input.re[475,11371+76]..[475,11371+77]) + Pexp_constant PConst_int (1,None) + ] + core_type (test/basicStructures.t/input.re[475,11371+47]..[475,11371+59]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[475,11371+48]..[475,11371+51]) + Ptyp_constr "int" (test/basicStructures.t/input.re[475,11371+48]..[475,11371+51]) + [] + core_type (test/basicStructures.t/input.re[475,11371+56]..[475,11371+59]) + Ptyp_constr "int" (test/basicStructures.t/input.re[475,11371+56]..[475,11371+59]) + [] + ] + structure_item (test/basicStructures.t/input.re[477,11451+0]..[477,11451+60]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[477,11451+4]..[477,11451+18]) + Ppat_var "curriedFormOne" (test/basicStructures.t/input.re[477,11451+4]..[477,11451+18]) + expression (test/basicStructures.t/input.re[477,11451+20]..[477,11451+60]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[477,11451+20]..[477,11451+25]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[477,11451+20]..[477,11451+21]) + Ppat_var "i" (test/basicStructures.t/input.re[477,11451+20]..[477,11451+21]) + core_type (test/basicStructures.t/input.re[477,11451+22]..[477,11451+25]) + Ptyp_constr "int" (test/basicStructures.t/input.re[477,11451+22]..[477,11451+25]) + [] + expression (test/basicStructures.t/input.re[477,11451+27]..[477,11451+60]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[477,11451+27]..[477,11451+35]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[477,11451+27]..[477,11451+28]) + Ppat_var "s" (test/basicStructures.t/input.re[477,11451+27]..[477,11451+28]) + core_type (test/basicStructures.t/input.re[477,11451+29]..[477,11451+35]) + Ptyp_constr "string" (test/basicStructures.t/input.re[477,11451+29]..[477,11451+35]) + [] + expression (test/basicStructures.t/input.re[477,11451+39]..[477,11451+60]) + Pexp_apply + expression (test/basicStructures.t/input.re[477,11451+41]..[477,11451+43]) + Pexp_ident "^" (test/basicStructures.t/input.re[477,11451+41]..[477,11451+43]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[477,11451+39]..[477,11451+40]) + Pexp_ident "s" (test/basicStructures.t/input.re[477,11451+39]..[477,11451+40]) + + Nolabel + expression (test/basicStructures.t/input.re[477,11451+44]..[477,11451+60]) + Pexp_apply + expression (test/basicStructures.t/input.re[477,11451+44]..[477,11451+57]) + Pexp_ident "string_of_int" (test/basicStructures.t/input.re[477,11451+44]..[477,11451+57]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[477,11451+58]..[477,11451+59]) + Pexp_ident "i" (test/basicStructures.t/input.re[477,11451+58]..[477,11451+59]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[479,11514+0]..[479,11514+54]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[479,11514+4]..[479,11514+18]) + Ppat_var "curriedFormTwo" (test/basicStructures.t/input.re[479,11514+4]..[479,11514+18]) + expression (test/basicStructures.t/input.re[479,11514+20]..[479,11514+54]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[479,11514+20]..[479,11514+25]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[479,11514+20]..[479,11514+21]) + Ppat_var "i" (test/basicStructures.t/input.re[479,11514+20]..[479,11514+21]) + core_type (test/basicStructures.t/input.re[479,11514+22]..[479,11514+25]) + Ptyp_constr "int" (test/basicStructures.t/input.re[479,11514+22]..[479,11514+25]) + [] + expression (test/basicStructures.t/input.re[479,11514+27]..[479,11514+54]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[479,11514+27]..[479,11514+32]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[479,11514+27]..[479,11514+28]) + Ppat_var "x" (test/basicStructures.t/input.re[479,11514+27]..[479,11514+28]) + core_type (test/basicStructures.t/input.re[479,11514+29]..[479,11514+32]) + Ptyp_constr "int" (test/basicStructures.t/input.re[479,11514+29]..[479,11514+32]) + [] + expression (test/basicStructures.t/input.re[479,11514+19]..[479,11514+54]) + Pexp_constraint + expression (test/basicStructures.t/input.re[479,11514+48]..[479,11514+54]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[479,11514+49]..[479,11514+50]) + Pexp_ident "i" (test/basicStructures.t/input.re[479,11514+49]..[479,11514+50]) + expression (test/basicStructures.t/input.re[479,11514+52]..[479,11514+53]) + Pexp_ident "x" (test/basicStructures.t/input.re[479,11514+52]..[479,11514+53]) + ] + core_type (test/basicStructures.t/input.re[479,11514+35]..[479,11514+45]) + Ptyp_tuple + [ + core_type (test/basicStructures.t/input.re[479,11514+36]..[479,11514+39]) + Ptyp_constr "int" (test/basicStructures.t/input.re[479,11514+36]..[479,11514+39]) + [] + core_type (test/basicStructures.t/input.re[479,11514+41]..[479,11514+44]) + Ptyp_constr "int" (test/basicStructures.t/input.re[479,11514+41]..[479,11514+44]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[482,11645+0]..[482,11645+84]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[482,11645+4]..[482,11645+20]) + Ppat_var "curriedFormThree" (test/basicStructures.t/input.re[482,11645+4]..[482,11645+20]) + expression (test/basicStructures.t/input.re[482,11645+22]..[482,11645+84]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[482,11645+22]..[482,11645+27]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[482,11645+22]..[482,11645+23]) + Ppat_var "i" (test/basicStructures.t/input.re[482,11645+22]..[482,11645+23]) + core_type (test/basicStructures.t/input.re[482,11645+24]..[482,11645+27]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+24]..[482,11645+27]) + [] + expression (test/basicStructures.t/input.re[482,11645+29]..[482,11645+84]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[482,11645+29]..[482,11645+54]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[482,11645+29]..[482,11645+43]) + Ppat_tuple + [ + pattern (test/basicStructures.t/input.re[482,11645+30]..[482,11645+35]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[482,11645+30]..[482,11645+31]) + Ppat_var "a" (test/basicStructures.t/input.re[482,11645+30]..[482,11645+31]) + core_type (test/basicStructures.t/input.re[482,11645+32]..[482,11645+35]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+32]..[482,11645+35]) + [] + pattern (test/basicStructures.t/input.re[482,11645+37]..[482,11645+42]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[482,11645+37]..[482,11645+38]) + Ppat_var "b" (test/basicStructures.t/input.re[482,11645+37]..[482,11645+38]) + core_type (test/basicStructures.t/input.re[482,11645+39]..[482,11645+42]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+39]..[482,11645+42]) + [] + ] + core_type (test/basicStructures.t/input.re[482,11645+44]..[482,11645+54]) + Ptyp_tuple + [ + core_type (test/basicStructures.t/input.re[482,11645+45]..[482,11645+48]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+45]..[482,11645+48]) + [] + core_type (test/basicStructures.t/input.re[482,11645+50]..[482,11645+53]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+50]..[482,11645+53]) + [] + ] + expression (test/basicStructures.t/input.re[482,11645+21]..[482,11645+84]) + Pexp_constraint + expression (test/basicStructures.t/input.re[482,11645+75]..[482,11645+84]) + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[482,11645+76]..[482,11645+77]) + Pexp_ident "i" (test/basicStructures.t/input.re[482,11645+76]..[482,11645+77]) + expression (test/basicStructures.t/input.re[482,11645+79]..[482,11645+80]) + Pexp_ident "a" (test/basicStructures.t/input.re[482,11645+79]..[482,11645+80]) + expression (test/basicStructures.t/input.re[482,11645+82]..[482,11645+83]) + Pexp_ident "b" (test/basicStructures.t/input.re[482,11645+82]..[482,11645+83]) + ] + core_type (test/basicStructures.t/input.re[482,11645+57]..[482,11645+72]) + Ptyp_tuple + [ + core_type (test/basicStructures.t/input.re[482,11645+58]..[482,11645+61]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+58]..[482,11645+61]) + [] + core_type (test/basicStructures.t/input.re[482,11645+63]..[482,11645+66]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+63]..[482,11645+66]) + [] + core_type (test/basicStructures.t/input.re[482,11645+68]..[482,11645+71]) + Ptyp_constr "int" (test/basicStructures.t/input.re[482,11645+68]..[482,11645+71]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[487,11839+0]..[491,12059+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[487,11839+0]..[491,12059+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[487,11839+0]..[491,12059+3]) + Pexp_constant PConst_string(" TODO: But this, however doesn't work.\n * let (myCurriedFunc: int => int) a => a;\n * Note: This is likely because only \"simple patterns\" are accepted as constraints\n * in let bindings - that may be easy to change.\n ",(test/basicStructures.t/input.re[487,11839+0]..[491,12059+3]),None) + ] + structure_item (test/basicStructures.t/input.re[493,12065+0]..[493,12065+35]) + Pstr_type Rec + [ + type_declaration "myFuncType" (test/basicStructures.t/input.re[493,12065+5]..[493,12065+15]) (test/basicStructures.t/input.re[493,12065+0]..[493,12065+35]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_abstract + ptype_private = Public + ptype_manifest = + Some + core_type (test/basicStructures.t/input.re[493,12065+18]..[493,12065+35]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[493,12065+19]..[493,12065+22]) + Ptyp_constr "int" (test/basicStructures.t/input.re[493,12065+19]..[493,12065+22]) + [] + core_type (test/basicStructures.t/input.re[493,12065+24]..[493,12065+35]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[493,12065+24]..[493,12065+27]) + Ptyp_constr "int" (test/basicStructures.t/input.re[493,12065+24]..[493,12065+27]) + [] + core_type (test/basicStructures.t/input.re[493,12065+32]..[493,12065+35]) + Ptyp_constr "int" (test/basicStructures.t/input.re[493,12065+32]..[493,12065+35]) + [] + ] + structure_item (test/basicStructures.t/input.re[495,12103+0]..[495,12103+43]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[495,12103+4]..[495,12103+10]) + Ppat_var "myFunc" (test/basicStructures.t/input.re[495,12103+4]..[495,12103+10]) + expression (test/basicStructures.t/input.re[495,12103+4]..[495,12103+43]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[495,12103+25]..[495,12103+43]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[495,12103+30]..[495,12103+31]) + Ppat_var "a" (test/basicStructures.t/input.re[495,12103+30]..[495,12103+31]) + expression (test/basicStructures.t/input.re[495,12103+32]..[495,12103+43]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[495,12103+32]..[495,12103+33]) + Ppat_var "b" (test/basicStructures.t/input.re[495,12103+32]..[495,12103+33]) + expression (test/basicStructures.t/input.re[495,12103+38]..[495,12103+43]) + Pexp_apply + expression (test/basicStructures.t/input.re[495,12103+40]..[495,12103+41]) + Pexp_ident "+" (test/basicStructures.t/input.re[495,12103+40]..[495,12103+41]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[495,12103+38]..[495,12103+39]) + Pexp_ident "a" (test/basicStructures.t/input.re[495,12103+38]..[495,12103+39]) + + Nolabel + expression (test/basicStructures.t/input.re[495,12103+42]..[495,12103+43]) + Pexp_ident "b" (test/basicStructures.t/input.re[495,12103+42]..[495,12103+43]) + ] + core_type (test/basicStructures.t/input.re[495,12103+12]..[495,12103+22]) + Ptyp_constr "myFuncType" (test/basicStructures.t/input.re[495,12103+12]..[495,12103+22]) + [] + ] + structure_item (test/basicStructures.t/input.re[497,12149+0]..[497,12149+103]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[497,12149+4]..[497,12149+36]) + Ppat_var "funcWithTypeLocallyAbstractTypes" (test/basicStructures.t/input.re[497,12149+4]..[497,12149+36]) + expression (test/basicStructures.t/input.re[497,12149+38]..[497,12149+103]) + Pexp_newtype "atype" + expression (test/basicStructures.t/input.re[497,12149+50]..[497,12149+103]) + Pexp_newtype "btype" + expression (test/basicStructures.t/input.re[497,12149+62]..[497,12149+103]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[497,12149+62]..[497,12149+63]) + Ppat_var "a" (test/basicStructures.t/input.re[497,12149+62]..[497,12149+63]) + expression (test/basicStructures.t/input.re[497,12149+65]..[497,12149+103]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[497,12149+65]..[497,12149+66]) + Ppat_var "b" (test/basicStructures.t/input.re[497,12149+65]..[497,12149+66]) + expression (test/basicStructures.t/input.re[497,12149+68]..[497,12149+103]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[497,12149+68]..[497,12149+93]) + Ppat_constraint + pattern (test/basicStructures.t/input.re[497,12149+68]..[497,12149+69]) + Ppat_var "c" (test/basicStructures.t/input.re[497,12149+68]..[497,12149+69]) + core_type (test/basicStructures.t/input.re[497,12149+71]..[497,12149+93]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[497,12149+72]..[497,12149+77]) + Ptyp_constr "atype" (test/basicStructures.t/input.re[497,12149+72]..[497,12149+77]) + [] + core_type (test/basicStructures.t/input.re[497,12149+79]..[497,12149+93]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[497,12149+79]..[497,12149+84]) + Ptyp_constr "btype" (test/basicStructures.t/input.re[497,12149+79]..[497,12149+84]) + [] + core_type (test/basicStructures.t/input.re[497,12149+89]..[497,12149+93]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[497,12149+89]..[497,12149+93]) + [] + expression (test/basicStructures.t/input.re[497,12149+97]..[497,12149+103]) + Pexp_apply + expression (test/basicStructures.t/input.re[497,12149+97]..[497,12149+98]) + Pexp_ident "c" (test/basicStructures.t/input.re[497,12149+97]..[497,12149+98]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[497,12149+99]..[497,12149+100]) + Pexp_ident "a" (test/basicStructures.t/input.re[497,12149+99]..[497,12149+100]) + + Nolabel + expression (test/basicStructures.t/input.re[497,12149+101]..[497,12149+102]) + Pexp_ident "b" (test/basicStructures.t/input.re[497,12149+101]..[497,12149+102]) + ] + ] + structure_item (test/basicStructures.t/input.re[500,12315+0]..[500,12315+25]) + Pstr_type Rec + [ + type_declaration "a" (test/basicStructures.t/input.re[500,12315+5]..[500,12315+6]) (test/basicStructures.t/input.re[500,12315+0]..[500,12315+25]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_abstract + ptype_private = Public + ptype_manifest = + Some + core_type (test/basicStructures.t/input.re[500,12315+9]..[500,12315+25]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[500,12315+11]..[500,12315+15]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[500,12315+11]..[500,12315+15]) + [] + core_type (test/basicStructures.t/input.re[500,12315+19]..[500,12315+23]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[500,12315+19]..[500,12315+23]) + [] + ] + structure_item (test/basicStructures.t/input.re[502,12343+0]..[505,12431+48]) + Pstr_type Rec + [ + type_declaration "b" (test/basicStructures.t/input.re[502,12343+5]..[502,12343+6]) (test/basicStructures.t/input.re[502,12343+0]..[505,12431+48]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_variant + [ + (test/basicStructures.t/input.re[503,12352+4]..[503,12352+23]) + "Foo" (test/basicStructures.t/input.re[503,12352+4]..[503,12352+7]) + [ + core_type (test/basicStructures.t/input.re[503,12352+8]..[503,12352+22]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[503,12352+9]..[503,12352+13]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[503,12352+9]..[503,12352+13]) + [] + core_type (test/basicStructures.t/input.re[503,12352+17]..[503,12352+21]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[503,12352+17]..[503,12352+21]) + [] + ] + None + (test/basicStructures.t/input.re[504,12376+4]..[504,12376+54]) + "Bar" (test/basicStructures.t/input.re[504,12376+4]..[504,12376+7]) + [ + core_type (test/basicStructures.t/input.re[504,12376+8]..[504,12376+22]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[504,12376+9]..[504,12376+13]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[504,12376+9]..[504,12376+13]) + [] + core_type (test/basicStructures.t/input.re[504,12376+17]..[504,12376+21]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[504,12376+17]..[504,12376+21]) + [] + core_type (test/basicStructures.t/input.re[504,12376+24]..[504,12376+38]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[504,12376+25]..[504,12376+29]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[504,12376+25]..[504,12376+29]) + [] + core_type (test/basicStructures.t/input.re[504,12376+33]..[504,12376+37]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[504,12376+33]..[504,12376+37]) + [] + core_type (test/basicStructures.t/input.re[504,12376+40]..[504,12376+53]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[504,12376+42]..[504,12376+43]) + Ptyp_constr "a" (test/basicStructures.t/input.re[504,12376+42]..[504,12376+43]) + [] + core_type (test/basicStructures.t/input.re[504,12376+45]..[504,12376+52]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[504,12376+45]..[504,12376+46]) + Ptyp_constr "b" (test/basicStructures.t/input.re[504,12376+45]..[504,12376+46]) + [] + core_type (test/basicStructures.t/input.re[504,12376+51]..[504,12376+52]) + Ptyp_constr "c" (test/basicStructures.t/input.re[504,12376+51]..[504,12376+52]) + [] + ] + None + (test/basicStructures.t/input.re[505,12431+4]..[505,12431+48]) + "Baz" (test/basicStructures.t/input.re[505,12431+4]..[505,12431+7]) + [ + core_type (test/basicStructures.t/input.re[505,12431+8]..[505,12431+20]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[505,12431+8]..[505,12431+12]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[505,12431+8]..[505,12431+12]) + [] + core_type (test/basicStructures.t/input.re[505,12431+16]..[505,12431+20]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[505,12431+16]..[505,12431+20]) + [] + core_type (test/basicStructures.t/input.re[505,12431+22]..[505,12431+34]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[505,12431+22]..[505,12431+26]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[505,12431+22]..[505,12431+26]) + [] + core_type (test/basicStructures.t/input.re[505,12431+30]..[505,12431+34]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[505,12431+30]..[505,12431+34]) + [] + core_type (test/basicStructures.t/input.re[505,12431+36]..[505,12431+47]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[505,12431+37]..[505,12431+38]) + Ptyp_constr "a" (test/basicStructures.t/input.re[505,12431+37]..[505,12431+38]) + [] + core_type (test/basicStructures.t/input.re[505,12431+40]..[505,12431+47]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[505,12431+40]..[505,12431+41]) + Ptyp_constr "b" (test/basicStructures.t/input.re[505,12431+40]..[505,12431+41]) + [] + core_type (test/basicStructures.t/input.re[505,12431+46]..[505,12431+47]) + Ptyp_constr "c" (test/basicStructures.t/input.re[505,12431+46]..[505,12431+47]) + [] + ] + None + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[507,12482+0]..[509,12515+25]) + Pstr_type Rec + [ + type_declaration "c" (test/basicStructures.t/input.re[507,12482+5]..[507,12482+6]) (test/basicStructures.t/input.re[507,12482+0]..[509,12515+25]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_variant + [ + (test/basicStructures.t/input.re[508,12491+4]..[508,12491+23]) + "Foo" (test/basicStructures.t/input.re[508,12491+4]..[508,12491+7]) + [ + core_type (test/basicStructures.t/input.re[508,12491+8]..[508,12491+22]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[508,12491+9]..[508,12491+10]) + Ptyp_constr "a" (test/basicStructures.t/input.re[508,12491+9]..[508,12491+10]) + [] + core_type (test/basicStructures.t/input.re[508,12491+12]..[508,12491+22]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[508,12491+12]..[508,12491+13]) + Ptyp_constr "b" (test/basicStructures.t/input.re[508,12491+12]..[508,12491+13]) + [] + core_type (test/basicStructures.t/input.re[508,12491+18]..[508,12491+22]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[508,12491+18]..[508,12491+22]) + [] + ] + None + (test/basicStructures.t/input.re[509,12515+4]..[509,12515+25]) + "Bar" (test/basicStructures.t/input.re[509,12515+4]..[509,12515+7]) + [ + core_type (test/basicStructures.t/input.re[509,12515+8]..[509,12515+24]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[509,12515+10]..[509,12515+11]) + Ptyp_constr "a" (test/basicStructures.t/input.re[509,12515+10]..[509,12515+11]) + [] + core_type (test/basicStructures.t/input.re[509,12515+13]..[509,12515+23]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[509,12515+13]..[509,12515+14]) + Ptyp_constr "b" (test/basicStructures.t/input.re[509,12515+13]..[509,12515+14]) + [] + core_type (test/basicStructures.t/input.re[509,12515+19]..[509,12515+23]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[509,12515+19]..[509,12515+23]) + [] + ] + None + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[511,12543+0]..[511,12543+35]) + Pstr_type Rec + [ + type_declaration "d" (test/basicStructures.t/input.re[511,12543+5]..[511,12543+6]) (test/basicStructures.t/input.re[511,12543+0]..[511,12543+35]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_abstract + ptype_private = Public + ptype_manifest = + Some + core_type (test/basicStructures.t/input.re[511,12543+9]..[511,12543+35]) + Ptyp_variant closed=Open + [ + Rtag "Foo" false + [ + core_type (test/basicStructures.t/input.re[511,12543+18]..[511,12543+34]) + Ptyp_arrow + Nolabel + core_type (test/basicStructures.t/input.re[511,12543+20]..[511,12543+24]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[511,12543+20]..[511,12543+24]) + [] + core_type (test/basicStructures.t/input.re[511,12543+28]..[511,12543+32]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[511,12543+28]..[511,12543+32]) + [] + ] + ] + None + ] + structure_item (test/basicStructures.t/input.re[514,12582+0]..[517,12678+3]) + Pstr_attribute "ocaml.text" + [ + structure_item (test/basicStructures.t/input.re[514,12582+0]..[517,12678+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[514,12582+0]..[517,12678+3]) + Pexp_constant PConst_string("\n * Records:\n *=============================================================================\n ",(test/basicStructures.t/input.re[514,12582+0]..[517,12678+3]),None) + ] + structure_item (test/basicStructures.t/input.re[519,12684+0]..[523,12758+1]) + Pstr_type Rec + [ + type_declaration "withThreeFields" (test/basicStructures.t/input.re[519,12684+5]..[519,12684+20]) (test/basicStructures.t/input.re[519,12684+0]..[523,12758+1]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[520,12709+2]..[520,12709+14]) + Immutable + "name" (test/basicStructures.t/input.re[520,12709+2]..[520,12709+6]) core_type (test/basicStructures.t/input.re[520,12709+8]..[520,12709+14]) + Ptyp_constr "string" (test/basicStructures.t/input.re[520,12709+8]..[520,12709+14]) + [] + (test/basicStructures.t/input.re[521,12725+2]..[521,12725+10]) + Immutable + "age" (test/basicStructures.t/input.re[521,12725+2]..[521,12725+5]) core_type (test/basicStructures.t/input.re[521,12725+7]..[521,12725+10]) + Ptyp_constr "int" (test/basicStructures.t/input.re[521,12725+7]..[521,12725+10]) + [] + (test/basicStructures.t/input.re[522,12737+2]..[522,12737+20]) + Immutable + "occupation" (test/basicStructures.t/input.re[522,12737+2]..[522,12737+12]) core_type (test/basicStructures.t/input.re[522,12737+14]..[522,12737+20]) + Ptyp_constr "string" (test/basicStructures.t/input.re[522,12737+14]..[522,12737+20]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[525,12762+0]..[529,12832+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[525,12762+4]..[525,12762+14]) + Ppat_var "testRecord" (test/basicStructures.t/input.re[525,12762+4]..[525,12762+14]) + expression (test/basicStructures.t/input.re[525,12762+17]..[529,12832+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[526,12781+2]..[526,12781+6]) + expression (test/basicStructures.t/input.re[526,12781+8]..[526,12781+13]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe",(test/basicStructures.t/input.re[526,12781+8]..[526,12781+13]),None) + ] + Pexp_constant PConst_string("joe",(test/basicStructures.t/input.re[526,12781+8]..[526,12781+13]),None) + "age" (test/basicStructures.t/input.re[527,12796+2]..[527,12796+5]) + expression (test/basicStructures.t/input.re[527,12796+7]..[527,12796+9]) + Pexp_constant PConst_int (20,None) + "occupation" (test/basicStructures.t/input.re[528,12807+2]..[528,12807+12]) + expression (test/basicStructures.t/input.re[528,12807+14]..[528,12807+24]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("engineer",(test/basicStructures.t/input.re[528,12807+14]..[528,12807+24]),None) + ] + Pexp_constant PConst_string("engineer",(test/basicStructures.t/input.re[528,12807+14]..[528,12807+24]),None) + ] + None + ] + structure_item (test/basicStructures.t/input.re[530,12835+0]..[534,12918+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[530,12835+4]..[530,12835+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[530,12835+4]..[530,12835+17]) + expression (test/basicStructures.t/input.re[530,12835+20]..[534,12918+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[532,12874+2]..[532,12874+6]) + expression (test/basicStructures.t/input.re[532,12874+8]..[532,12874+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[532,12874+8]..[532,12874+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[532,12874+8]..[532,12874+15]),None) + "age" (test/basicStructures.t/input.re[533,12891+2]..[533,12891+5]) + expression (test/basicStructures.t/input.re[533,12891+7]..[533,12891+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[533,12891+22]..[533,12891+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[533,12891+22]..[533,12891+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[533,12891+7]..[533,12891+21]) + Pexp_field + expression (test/basicStructures.t/input.re[533,12891+7]..[533,12891+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[533,12891+7]..[533,12891+17]) + "age" (test/basicStructures.t/input.re[533,12891+18]..[533,12891+21]) + + Nolabel + expression (test/basicStructures.t/input.re[533,12891+24]..[533,12891+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[531,12857+5]..[531,12857+15]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[531,12857+5]..[531,12857+15]) + ] + structure_item (test/basicStructures.t/input.re[536,12922+0]..[536,12922+68]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[536,12922+4]..[536,12922+18]) + Ppat_var "makeRecordBase" (test/basicStructures.t/input.re[536,12922+4]..[536,12922+18]) + expression (test/basicStructures.t/input.re[536,12922+19]..[536,12922+68]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[536,12922+19]..[536,12922+21]) + Ppat_construct "()" (test/basicStructures.t/input.re[536,12922+19]..[536,12922+21]) + None + expression (test/basicStructures.t/input.re[536,12922+22]..[536,12922+68]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[536,12922+23]..[536,12922+27]) + expression (test/basicStructures.t/input.re[536,12922+29]..[536,12922+34]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Joe",(test/basicStructures.t/input.re[536,12922+29]..[536,12922+34]),None) + ] + Pexp_constant PConst_string("Joe",(test/basicStructures.t/input.re[536,12922+29]..[536,12922+34]),None) + "age" (test/basicStructures.t/input.re[536,12922+36]..[536,12922+39]) + expression (test/basicStructures.t/input.re[536,12922+41]..[536,12922+43]) + Pexp_constant PConst_int (30,None) + "occupation" (test/basicStructures.t/input.re[536,12922+45]..[536,12922+55]) + expression (test/basicStructures.t/input.re[536,12922+57]..[536,12922+67]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("Engineer",(test/basicStructures.t/input.re[536,12922+57]..[536,12922+67]),None) + ] + Pexp_constant PConst_string("Engineer",(test/basicStructures.t/input.re[536,12922+57]..[536,12922+67]),None) + ] + None + ] + structure_item (test/basicStructures.t/input.re[537,12992+0]..[542,13127+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[537,12992+4]..[537,12992+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[537,12992+4]..[537,12992+17]) + expression (test/basicStructures.t/input.re[537,12992+20]..[542,13127+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[540,13083+2]..[540,13083+6]) + expression (test/basicStructures.t/input.re[540,13083+8]..[540,13083+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[540,13083+8]..[540,13083+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[540,13083+8]..[540,13083+15]),None) + "age" (test/basicStructures.t/input.re[541,13100+2]..[541,13100+5]) + expression (test/basicStructures.t/input.re[541,13100+7]..[541,13100+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[541,13100+22]..[541,13100+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[541,13100+22]..[541,13100+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[541,13100+7]..[541,13100+21]) + Pexp_field + expression (test/basicStructures.t/input.re[541,13100+7]..[541,13100+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[541,13100+7]..[541,13100+17]) + "age" (test/basicStructures.t/input.re[541,13100+18]..[541,13100+21]) + + Nolabel + expression (test/basicStructures.t/input.re[541,13100+24]..[541,13100+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[539,13057+5]..[539,13057+24]) + Pexp_apply + expression (test/basicStructures.t/input.re[539,13057+6]..[539,13057+20]) + Pexp_ident "makeRecordBase" (test/basicStructures.t/input.re[539,13057+6]..[539,13057+20]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[539,13057+21]..[539,13057+23]) + Pexp_construct "()" (test/basicStructures.t/input.re[539,13057+21]..[539,13057+23]) + None + ] + ] + structure_item (test/basicStructures.t/input.re[544,13131+0]..[550,13325+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[544,13131+4]..[544,13131+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[544,13131+4]..[544,13131+17]) + expression (test/basicStructures.t/input.re[544,13131+20]..[550,13325+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[548,13281+2]..[548,13281+6]) + expression (test/basicStructures.t/input.re[548,13281+8]..[548,13281+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[548,13281+8]..[548,13281+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[548,13281+8]..[548,13281+15]),None) + "age" (test/basicStructures.t/input.re[549,13298+2]..[549,13298+5]) + expression (test/basicStructures.t/input.re[549,13298+7]..[549,13298+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[549,13298+22]..[549,13298+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[549,13298+22]..[549,13298+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[549,13298+7]..[549,13298+21]) + Pexp_field + expression (test/basicStructures.t/input.re[549,13298+7]..[549,13298+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[549,13298+7]..[549,13298+17]) + "age" (test/basicStructures.t/input.re[549,13298+18]..[549,13298+21]) + + Nolabel + expression (test/basicStructures.t/input.re[549,13298+24]..[549,13298+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[546,13219+5]..[546,13219+21]) + Pexp_apply + expression (test/basicStructures.t/input.re[546,13219+5]..[546,13219+19]) + Pexp_ident "makeRecordBase" (test/basicStructures.t/input.re[546,13219+5]..[546,13219+19]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[546,13219+19]..[546,13219+21]) + Pexp_construct "()" (test/basicStructures.t/input.re[546,13219+19]..[546,13219+21]) + None + ] + ] + structure_item (test/basicStructures.t/input.re[552,13329+0]..[557,13526+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[552,13329+4]..[552,13329+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[552,13329+4]..[552,13329+17]) + expression (test/basicStructures.t/input.re[552,13329+20]..[557,13526+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[555,13482+2]..[555,13482+6]) + expression (test/basicStructures.t/input.re[555,13482+8]..[555,13482+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[555,13482+8]..[555,13482+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[555,13482+8]..[555,13482+15]),None) + "age" (test/basicStructures.t/input.re[556,13499+2]..[556,13499+5]) + expression (test/basicStructures.t/input.re[556,13499+7]..[556,13499+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[556,13499+22]..[556,13499+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[556,13499+22]..[556,13499+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[556,13499+7]..[556,13499+21]) + Pexp_field + expression (test/basicStructures.t/input.re[556,13499+7]..[556,13499+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[556,13499+7]..[556,13499+17]) + "age" (test/basicStructures.t/input.re[556,13499+18]..[556,13499+21]) + + Nolabel + expression (test/basicStructures.t/input.re[556,13499+24]..[556,13499+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[554,13438+5]..[554,13438+42]) + Pexp_constraint + expression (test/basicStructures.t/input.re[554,13438+6]..[554,13438+23]) + Pexp_apply + expression (test/basicStructures.t/input.re[554,13438+6]..[554,13438+20]) + Pexp_ident "makeRecordBase" (test/basicStructures.t/input.re[554,13438+6]..[554,13438+20]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[554,13438+21]..[554,13438+23]) + Pexp_construct "()" (test/basicStructures.t/input.re[554,13438+21]..[554,13438+23]) + None + ] + core_type (test/basicStructures.t/input.re[554,13438+26]..[554,13438+41]) + Ptyp_constr "withThreeFields" (test/basicStructures.t/input.re[554,13438+26]..[554,13438+41]) + [] + ] + structure_item (test/basicStructures.t/input.re[560,13531+0]..[565,13656+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[560,13531+4]..[560,13531+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[560,13531+4]..[560,13531+17]) + expression (test/basicStructures.t/input.re[560,13531+20]..[565,13656+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[563,13612+2]..[563,13612+6]) + expression (test/basicStructures.t/input.re[563,13612+8]..[563,13612+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[563,13612+8]..[563,13612+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[563,13612+8]..[563,13612+15]),None) + "age" (test/basicStructures.t/input.re[564,13629+2]..[564,13629+5]) + expression (test/basicStructures.t/input.re[564,13629+7]..[564,13629+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[564,13629+22]..[564,13629+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[564,13629+22]..[564,13629+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[564,13629+7]..[564,13629+21]) + Pexp_field + expression (test/basicStructures.t/input.re[564,13629+7]..[564,13629+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[564,13629+7]..[564,13629+17]) + "age" (test/basicStructures.t/input.re[564,13629+18]..[564,13629+21]) + + Nolabel + expression (test/basicStructures.t/input.re[564,13629+24]..[564,13629+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[562,13587+5]..[562,13587+23]) + Pexp_apply + expression (test/basicStructures.t/input.re[562,13587+5]..[562,13587+23]) ghost + Pexp_ident "String.set" (test/basicStructures.t/input.re[562,13587+5]..[562,13587+23]) ghost + [ + + Nolabel + expression (test/basicStructures.t/input.re[562,13587+5]..[562,13587+14]) + Pexp_ident "someArray" (test/basicStructures.t/input.re[562,13587+5]..[562,13587+14]) + + Nolabel + expression (test/basicStructures.t/input.re[562,13587+16]..[562,13587+17]) + Pexp_constant PConst_int (0,None) + + Nolabel + expression (test/basicStructures.t/input.re[562,13587+21]..[562,13587+23]) + Pexp_constant PConst_int (20,None) + ] + ] + structure_item (test/basicStructures.t/input.re[567,13660+0]..[574,13825+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[567,13660+4]..[567,13660+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[567,13660+4]..[567,13660+17]) + expression (test/basicStructures.t/input.re[567,13660+20]..[574,13825+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[572,13781+2]..[572,13781+6]) + expression (test/basicStructures.t/input.re[572,13781+8]..[572,13781+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[572,13781+8]..[572,13781+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[572,13781+8]..[572,13781+15]),None) + "age" (test/basicStructures.t/input.re[573,13798+2]..[573,13798+5]) + expression (test/basicStructures.t/input.re[573,13798+7]..[573,13798+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[573,13798+22]..[573,13798+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[573,13798+22]..[573,13798+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[573,13798+7]..[573,13798+21]) + Pexp_field + expression (test/basicStructures.t/input.re[573,13798+7]..[573,13798+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[573,13798+7]..[573,13798+17]) + "age" (test/basicStructures.t/input.re[573,13798+18]..[573,13798+21]) + + Nolabel + expression (test/basicStructures.t/input.re[573,13798+24]..[573,13798+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[568,13682+5]..[571,13776+3]) + Pexp_apply + expression (test/basicStructures.t/input.re[568,13682+5]..[568,13682+32]) + Pexp_ident "SomeReally.longFunctionCall" (test/basicStructures.t/input.re[568,13682+5]..[568,13682+32]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[568,13682+33]..[571,13776+3]) + Pexp_record + [ + "passingRecordField" (test/basicStructures.t/input.re[569,13717+4]..[569,13717+22]) + expression (test/basicStructures.t/input.re[569,13717+24]..[569,13717+25]) + Pexp_constant PConst_int (0,None) + "andThisOtherRecordField" (test/basicStructures.t/input.re[570,13744+4]..[570,13744+27]) + expression (test/basicStructures.t/input.re[570,13744+29]..[570,13744+31]) + Pexp_constant PConst_int (10,None) + ] + None + ] + ] + structure_item (test/basicStructures.t/input.re[576,13829+0]..[580,13959+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[576,13829+4]..[576,13829+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[576,13829+4]..[576,13829+17]) + expression (test/basicStructures.t/input.re[576,13829+20]..[580,13959+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[578,13915+2]..[578,13915+6]) + expression (test/basicStructures.t/input.re[578,13915+8]..[578,13915+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[578,13915+8]..[578,13915+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[578,13915+8]..[578,13915+15]),None) + "age" (test/basicStructures.t/input.re[579,13932+2]..[579,13932+5]) + expression (test/basicStructures.t/input.re[579,13932+7]..[579,13932+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[579,13932+22]..[579,13932+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[579,13932+22]..[579,13932+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[579,13932+7]..[579,13932+21]) + Pexp_field + expression (test/basicStructures.t/input.re[579,13932+7]..[579,13932+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[579,13932+7]..[579,13932+17]) + "age" (test/basicStructures.t/input.re[579,13932+18]..[579,13932+21]) + + Nolabel + expression (test/basicStructures.t/input.re[579,13932+24]..[579,13932+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[577,13851+5]..[577,13851+62]) + Pexp_apply + expression (test/basicStructures.t/input.re[577,13851+5]..[577,13851+32]) + Pexp_ident "SomeReally.longFunctionCall" (test/basicStructures.t/input.re[577,13851+5]..[577,13851+32]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[577,13851+33]..[577,13851+46]) + Pexp_ident "withArguments" (test/basicStructures.t/input.re[577,13851+33]..[577,13851+46]) + + Nolabel + expression (test/basicStructures.t/input.re[577,13851+48]..[577,13851+61]) ghost + Pexp_constraint + expression (test/basicStructures.t/input.re[577,13851+48]..[577,13851+56]) + Pexp_ident "thatWrap" (test/basicStructures.t/input.re[577,13851+48]..[577,13851+56]) + core_type (test/basicStructures.t/input.re[577,13851+57]..[577,13851+61]) + Ptyp_constr "bool" (test/basicStructures.t/input.re[577,13851+57]..[577,13851+61]) + [] + ] + ] + structure_item (test/basicStructures.t/input.re[582,13963+0]..[588,14133+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[582,13963+4]..[582,13963+17]) + Ppat_var "anotherRecord" (test/basicStructures.t/input.re[582,13963+4]..[582,13963+17]) + expression (test/basicStructures.t/input.re[582,13963+20]..[588,14133+1]) + Pexp_record + [ + "name" (test/basicStructures.t/input.re[586,14089+2]..[586,14089+6]) + expression (test/basicStructures.t/input.re[586,14089+8]..[586,14089+15]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[586,14089+8]..[586,14089+15]),None) + ] + Pexp_constant PConst_string("joe++",(test/basicStructures.t/input.re[586,14089+8]..[586,14089+15]),None) + "age" (test/basicStructures.t/input.re[587,14106+2]..[587,14106+5]) + expression (test/basicStructures.t/input.re[587,14106+7]..[587,14106+26]) + Pexp_apply + expression (test/basicStructures.t/input.re[587,14106+22]..[587,14106+23]) + Pexp_ident "+" (test/basicStructures.t/input.re[587,14106+22]..[587,14106+23]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[587,14106+7]..[587,14106+21]) + Pexp_field + expression (test/basicStructures.t/input.re[587,14106+7]..[587,14106+17]) + Pexp_ident "testRecord" (test/basicStructures.t/input.re[587,14106+7]..[587,14106+17]) + "age" (test/basicStructures.t/input.re[587,14106+18]..[587,14106+21]) + + Nolabel + expression (test/basicStructures.t/input.re[587,14106+24]..[587,14106+26]) + Pexp_constant PConst_int (10,None) + ] + ] + Some + expression (test/basicStructures.t/input.re[583,13985+5]..[585,14031+56]) + Pexp_apply + expression (test/basicStructures.t/input.re[583,13985+5]..[583,13985+32]) + Pexp_ident "SomeReally.longFunctionCall" (test/basicStructures.t/input.re[583,13985+5]..[583,13985+32]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[584,14018+4]..[584,14018+11]) + Pexp_ident "withArg" (test/basicStructures.t/input.re[584,14018+4]..[584,14018+11]) + + Nolabel + expression (test/basicStructures.t/input.re[585,14031+4]..[585,14031+55]) + Pexp_construct "::" (test/basicStructures.t/input.re[585,14031+5]..[585,14031+54]) + Some + expression (test/basicStructures.t/input.re[585,14031+5]..[585,14031+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[585,14031+5]..[585,14031+10]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("and",(test/basicStructures.t/input.re[585,14031+5]..[585,14031+10]),None) + ] + Pexp_constant PConst_string("and",(test/basicStructures.t/input.re[585,14031+5]..[585,14031+10]),None) + expression (test/basicStructures.t/input.re[585,14031+12]..[585,14031+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[585,14031+12]..[585,14031+54]) + Some + expression (test/basicStructures.t/input.re[585,14031+12]..[585,14031+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[585,14031+12]..[585,14031+19]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("final",(test/basicStructures.t/input.re[585,14031+12]..[585,14031+19]),None) + ] + Pexp_constant PConst_string("final",(test/basicStructures.t/input.re[585,14031+12]..[585,14031+19]),None) + expression (test/basicStructures.t/input.re[585,14031+21]..[585,14031+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[585,14031+21]..[585,14031+54]) + Some + expression (test/basicStructures.t/input.re[585,14031+21]..[585,14031+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[585,14031+21]..[585,14031+27]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("list",(test/basicStructures.t/input.re[585,14031+21]..[585,14031+27]),None) + ] + Pexp_constant PConst_string("list",(test/basicStructures.t/input.re[585,14031+21]..[585,14031+27]),None) + expression (test/basicStructures.t/input.re[585,14031+29]..[585,14031+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[585,14031+29]..[585,14031+54]) + Some + expression (test/basicStructures.t/input.re[585,14031+29]..[585,14031+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[585,14031+29]..[585,14031+35]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("that",(test/basicStructures.t/input.re[585,14031+29]..[585,14031+35]),None) + ] + Pexp_constant PConst_string("that",(test/basicStructures.t/input.re[585,14031+29]..[585,14031+35]),None) + expression (test/basicStructures.t/input.re[585,14031+37]..[585,14031+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[585,14031+37]..[585,14031+54]) + Some + expression (test/basicStructures.t/input.re[585,14031+37]..[585,14031+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[585,14031+37]..[585,14031+45]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("should",(test/basicStructures.t/input.re[585,14031+37]..[585,14031+45]),None) + ] + Pexp_constant PConst_string("should",(test/basicStructures.t/input.re[585,14031+37]..[585,14031+45]),None) + expression (test/basicStructures.t/input.re[585,14031+47]..[585,14031+54]) ghost + Pexp_construct "::" (test/basicStructures.t/input.re[585,14031+47]..[585,14031+54]) + Some + expression (test/basicStructures.t/input.re[585,14031+47]..[585,14031+54]) ghost + Pexp_tuple + [ + expression (test/basicStructures.t/input.re[585,14031+47]..[585,14031+54]) + attribute "reason.raw_literal" + [ +structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("break",(test/basicStructures.t/input.re[585,14031+47]..[585,14031+54]),None) + ] + Pexp_constant PConst_string("break",(test/basicStructures.t/input.re[585,14031+47]..[585,14031+54]),None) + expression (test/basicStructures.t/input.re[585,14031+5]..[585,14031+54]) ghost + Pexp_construct "[]" (test/basicStructures.t/input.re[585,14031+5]..[585,14031+54]) ghost + None + ] + ] + ] + ] + ] + ] + ] + ] + structure_item (test/basicStructures.t/input.re[591,14163+0]..[591,14163+28]) + Pstr_type Rec + [ + type_declaration "props" (test/basicStructures.t/input.re[591,14163+5]..[591,14163+10]) (test/basicStructures.t/input.re[591,14163+0]..[591,14163+28]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[591,14163+14]..[591,14163+27]) + Immutable + "title" (test/basicStructures.t/input.re[591,14163+14]..[591,14163+19]) core_type (test/basicStructures.t/input.re[591,14163+21]..[591,14163+27]) + Ptyp_constr "string" (test/basicStructures.t/input.re[591,14163+21]..[591,14163+27]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[593,14194+0]..[593,14194+17]) + Pstr_type Rec + [ + type_declaration "state" (test/basicStructures.t/input.re[593,14194+5]..[593,14194+10]) (test/basicStructures.t/input.re[593,14194+0]..[593,14194+17]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_abstract + ptype_private = Public + ptype_manifest = + Some + core_type (test/basicStructures.t/input.re[593,14194+13]..[593,14194+17]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[593,14194+13]..[593,14194+17]) + [] + ] + structure_item (test/basicStructures.t/input.re[595,14214+0]..[595,14214+24]) + Pstr_type Rec + [ + type_declaration "component" (test/basicStructures.t/input.re[595,14214+5]..[595,14214+14]) (test/basicStructures.t/input.re[595,14214+0]..[595,14214+24]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[595,14214+18]..[595,14214+23]) + Immutable + "props" (test/basicStructures.t/input.re[595,14214+18]..[595,14214+23]) core_type (test/basicStructures.t/input.re[595,14214+18]..[595,14214+23]) + Ptyp_constr "props" (test/basicStructures.t/input.re[595,14214+18]..[595,14214+23]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[597,14241+0]..[597,14241+48]) + Pstr_type Rec + [ + type_declaration "component2" (test/basicStructures.t/input.re[597,14241+5]..[597,14241+15]) (test/basicStructures.t/input.re[597,14241+0]..[597,14241+48]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[597,14241+19]..[597,14241+24]) + Immutable + "props" (test/basicStructures.t/input.re[597,14241+19]..[597,14241+24]) core_type (test/basicStructures.t/input.re[597,14241+19]..[597,14241+24]) + Ptyp_constr "props" (test/basicStructures.t/input.re[597,14241+19]..[597,14241+24]) + [] + (test/basicStructures.t/input.re[597,14241+26]..[597,14241+31]) + Immutable + "state" (test/basicStructures.t/input.re[597,14241+26]..[597,14241+31]) core_type (test/basicStructures.t/input.re[597,14241+26]..[597,14241+31]) + Ptyp_constr "state" (test/basicStructures.t/input.re[597,14241+26]..[597,14241+31]) + [] + (test/basicStructures.t/input.re[597,14241+33]..[597,14241+46]) + Immutable + "updater" (test/basicStructures.t/input.re[597,14241+33]..[597,14241+40]) core_type (test/basicStructures.t/input.re[597,14241+42]..[597,14241+46]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[597,14241+42]..[597,14241+46]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[599,14292+0]..[599,14292+41]) + Pstr_type Rec + [ + type_declaration "component3" (test/basicStructures.t/input.re[599,14292+5]..[599,14292+15]) (test/basicStructures.t/input.re[599,14292+0]..[599,14292+41]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[599,14292+19]..[599,14292+33]) + Immutable + "props" (test/basicStructures.t/input.re[599,14292+19]..[599,14292+24]) core_type (test/basicStructures.t/input.re[599,14292+26]..[599,14292+33]) + Ptyp_constr "M.props" (test/basicStructures.t/input.re[599,14292+26]..[599,14292+33]) + [] + (test/basicStructures.t/input.re[599,14292+35]..[599,14292+40]) + Immutable + "state" (test/basicStructures.t/input.re[599,14292+35]..[599,14292+40]) core_type (test/basicStructures.t/input.re[599,14292+35]..[599,14292+40]) + Ptyp_constr "state" (test/basicStructures.t/input.re[599,14292+35]..[599,14292+40]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[601,14336+0]..[601,14336+39]) + Pstr_type Rec + [ + type_declaration "mutableComponent" (test/basicStructures.t/input.re[601,14336+5]..[601,14336+21]) (test/basicStructures.t/input.re[601,14336+0]..[601,14336+39]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[601,14336+25]..[601,14336+38]) + Mutable + "props" (test/basicStructures.t/input.re[601,14336+33]..[601,14336+38]) core_type (test/basicStructures.t/input.re[601,14336+33]..[601,14336+38]) + Ptyp_constr "props" (test/basicStructures.t/input.re[601,14336+33]..[601,14336+38]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[603,14378+0]..[603,14378+69]) + Pstr_type Rec + [ + type_declaration "mutabeleComponent2" (test/basicStructures.t/input.re[603,14378+5]..[603,14378+23]) (test/basicStructures.t/input.re[603,14378+0]..[603,14378+69]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[603,14378+27]..[603,14378+40]) + Mutable + "props" (test/basicStructures.t/input.re[603,14378+35]..[603,14378+40]) core_type (test/basicStructures.t/input.re[603,14378+35]..[603,14378+40]) + Ptyp_constr "props" (test/basicStructures.t/input.re[603,14378+35]..[603,14378+40]) + [] + (test/basicStructures.t/input.re[603,14378+42]..[603,14378+55]) + Mutable + "state" (test/basicStructures.t/input.re[603,14378+50]..[603,14378+55]) core_type (test/basicStructures.t/input.re[603,14378+50]..[603,14378+55]) + Ptyp_constr "state" (test/basicStructures.t/input.re[603,14378+50]..[603,14378+55]) + [] + (test/basicStructures.t/input.re[603,14378+57]..[603,14378+67]) + Immutable + "style" (test/basicStructures.t/input.re[603,14378+57]..[603,14378+62]) core_type (test/basicStructures.t/input.re[603,14378+64]..[603,14378+67]) + Ptyp_constr "int" (test/basicStructures.t/input.re[603,14378+64]..[603,14378+67]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[606,14486+0]..[609,14553+1]) + Pstr_type Rec + [ + type_declaration "description" (test/basicStructures.t/input.re[606,14486+5]..[606,14486+16]) (test/basicStructures.t/input.re[606,14486+0]..[609,14553+1]) + ptype_params = + [ + core_type (test/basicStructures.t/input.re[606,14486+17]..[606,14486+23]) + Ptyp_var props + ] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[607,14515+2]..[607,14515+17]) + Immutable + "element" (test/basicStructures.t/input.re[607,14515+2]..[607,14515+9]) core_type (test/basicStructures.t/input.re[607,14515+11]..[607,14515+17]) + Ptyp_constr "string" (test/basicStructures.t/input.re[607,14515+11]..[607,14515+17]) + [] + (test/basicStructures.t/input.re[608,14534+2]..[608,14534+18]) + Immutable + "tag" (test/basicStructures.t/input.re[608,14534+2]..[608,14534+5]) core_type (test/basicStructures.t/input.re[608,14534+7]..[608,14534+18]) + Ptyp_constr "tag" (test/basicStructures.t/input.re[608,14534+7]..[608,14534+10]) + [ + core_type (test/basicStructures.t/input.re[608,14534+11]..[608,14534+17]) + Ptyp_var props + ] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[612,14598+0]..[614,14642+1]) + Pstr_module + "Foo" (test/basicStructures.t/input.re[612,14598+7]..[612,14598+10]) + module_expr (test/basicStructures.t/input.re[612,14598+13]..[614,14642+1]) + Pmod_structure + [ + structure_item (test/basicStructures.t/input.re[613,14613+2]..[613,14613+27]) + Pstr_type Rec + [ + type_declaration "bar" (test/basicStructures.t/input.re[613,14613+7]..[613,14613+10]) (test/basicStructures.t/input.re[613,14613+2]..[613,14613+27]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[613,14613+14]..[613,14613+26]) + Immutable + "foo" (test/basicStructures.t/input.re[613,14613+14]..[613,14613+17]) core_type (test/basicStructures.t/input.re[613,14613+19]..[613,14613+26]) + Ptyp_constr "Baz.foo" (test/basicStructures.t/input.re[613,14613+19]..[613,14613+26]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + ] + structure_item (test/basicStructures.t/input.re[617,14695+0]..[621,14754+1]) + Pstr_type Rec + [ + type_declaration "foo" (test/basicStructures.t/input.re[617,14695+5]..[617,14695+8]) (test/basicStructures.t/input.re[617,14695+0]..[621,14754+1]) + ptype_params = + [] + ptype_cstrs = + [] + ptype_kind = + Ptype_record + [ + (test/basicStructures.t/input.re[618,14708+2]..[618,14708+14]) + Immutable + "bar" (test/basicStructures.t/input.re[618,14708+2]..[618,14708+5]) core_type (test/basicStructures.t/input.re[618,14708+7]..[618,14708+14]) + Ptyp_constr "Baz.bar" (test/basicStructures.t/input.re[618,14708+7]..[618,14708+14]) + [] + (test/basicStructures.t/input.re[619,14724+2]..[619,14724+10]) + Immutable + "qux" (test/basicStructures.t/input.re[619,14724+2]..[619,14724+5]) core_type (test/basicStructures.t/input.re[619,14724+7]..[619,14724+10]) + Ptyp_constr "qux" (test/basicStructures.t/input.re[619,14724+7]..[619,14724+10]) + [] + (test/basicStructures.t/input.re[620,14736+2]..[620,14736+17]) + Immutable + "fooo" (test/basicStructures.t/input.re[620,14736+2]..[620,14736+6]) core_type (test/basicStructures.t/input.re[620,14736+8]..[620,14736+17]) + Ptyp_constr "Fooo.fooo" (test/basicStructures.t/input.re[620,14736+8]..[620,14736+17]) + [] + ] + ptype_private = Public + ptype_manifest = + None + ] + structure_item (test/basicStructures.t/input.re[623,14758+0]..[627,14820+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[623,14758+4]..[623,14758+11]) + Ppat_var "moreFoo" (test/basicStructures.t/input.re[623,14758+4]..[623,14758+11]) + expression (test/basicStructures.t/input.re[623,14758+14]..[627,14820+1]) + Pexp_record + [ + "bar" (test/basicStructures.t/input.re[624,14774+2]..[624,14774+5]) + expression (test/basicStructures.t/input.re[624,14774+7]..[624,14774+14]) + Pexp_ident "Baz.bar" (test/basicStructures.t/input.re[624,14774+7]..[624,14774+14]) + "qux" (test/basicStructures.t/input.re[625,14790+2]..[625,14790+5]) + expression (test/basicStructures.t/input.re[625,14790+7]..[625,14790+10]) + Pexp_ident "qux" (test/basicStructures.t/input.re[625,14790+7]..[625,14790+10]) + "fooo" (test/basicStructures.t/input.re[626,14802+2]..[626,14802+6]) + expression (test/basicStructures.t/input.re[626,14802+8]..[626,14802+17]) + Pexp_ident "Fooo.fooo" (test/basicStructures.t/input.re[626,14802+8]..[626,14802+17]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[631,14852+0]..[631,14852+25]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[631,14852+4]..[631,14852+9]) + Ppat_var "props" (test/basicStructures.t/input.re[631,14852+4]..[631,14852+9]) + expression (test/basicStructures.t/input.re[631,14852+12]..[631,14852+25]) + Pexp_record + [ + "title" (test/basicStructures.t/input.re[631,14852+13]..[631,14852+18]) + expression (test/basicStructures.t/input.re[631,14852+20]..[631,14852+24]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("hi",(test/basicStructures.t/input.re[631,14852+20]..[631,14852+24]),None) + ] + Pexp_constant PConst_string("hi",(test/basicStructures.t/input.re[631,14852+20]..[631,14852+24]),None) + ] + None + ] + structure_item (test/basicStructures.t/input.re[633,14978+0]..[633,14978+31]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[633,14978+4]..[633,14978+14]) + Ppat_var "componentA" (test/basicStructures.t/input.re[633,14978+4]..[633,14978+14]) + expression (test/basicStructures.t/input.re[633,14978+17]..[633,14978+31]) + Pexp_record + [ + "props" (test/basicStructures.t/input.re[633,14978+18]..[633,14978+23]) + expression (test/basicStructures.t/input.re[633,14978+25]..[633,14978+30]) + Pexp_ident "props" (test/basicStructures.t/input.re[633,14978+25]..[633,14978+30]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[635,15030+0]..[635,15030+42]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[635,15030+4]..[635,15030+14]) + Ppat_var "componentB" (test/basicStructures.t/input.re[635,15030+4]..[635,15030+14]) + expression (test/basicStructures.t/input.re[635,15030+17]..[635,15030+42]) + Pexp_record + [ + "props" (test/basicStructures.t/input.re[635,15030+18]..[635,15030+23]) + expression (test/basicStructures.t/input.re[635,15030+25]..[635,15030+30]) + Pexp_ident "props" (test/basicStructures.t/input.re[635,15030+25]..[635,15030+30]) + "state" (test/basicStructures.t/input.re[635,15030+32]..[635,15030+37]) + expression (test/basicStructures.t/input.re[635,15030+39]..[635,15030+41]) + Pexp_construct "()" (test/basicStructures.t/input.re[635,15030+39]..[635,15030+41]) + None + ] + None + ] + structure_item (test/basicStructures.t/input.re[637,15114+0]..[637,15114+24]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[637,15114+4]..[637,15114+7]) + Ppat_var "foo" (test/basicStructures.t/input.re[637,15114+4]..[637,15114+7]) + expression (test/basicStructures.t/input.re[637,15114+10]..[637,15114+24]) + Pexp_record + [ + "Foo.foo" (test/basicStructures.t/input.re[637,15114+11]..[637,15114+18]) + expression (test/basicStructures.t/input.re[637,15114+20]..[637,15114+23]) + Pexp_ident "foo" (test/basicStructures.t/input.re[637,15114+20]..[637,15114+23]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[638,15140+0]..[638,15140+32]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[638,15140+4]..[638,15140+7]) + Ppat_var "bar" (test/basicStructures.t/input.re[638,15140+4]..[638,15140+7]) + expression (test/basicStructures.t/input.re[638,15140+10]..[638,15140+32]) + Pexp_record + [ + "Foo.foo" (test/basicStructures.t/input.re[638,15140+11]..[638,15140+18]) + expression (test/basicStructures.t/input.re[638,15140+20]..[638,15140+23]) + Pexp_ident "foo" (test/basicStructures.t/input.re[638,15140+20]..[638,15140+23]) + "bar" (test/basicStructures.t/input.re[638,15140+25]..[638,15140+28]) + expression (test/basicStructures.t/input.re[638,15140+30]..[638,15140+31]) + Pexp_constant PConst_int (1,None) + ] + None + ] + structure_item (test/basicStructures.t/input.re[639,15174+0]..[639,15174+32]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[639,15174+4]..[639,15174+7]) + Ppat_var "bar" (test/basicStructures.t/input.re[639,15174+4]..[639,15174+7]) + expression (test/basicStructures.t/input.re[639,15174+10]..[639,15174+32]) + Pexp_record + [ + "bar" (test/basicStructures.t/input.re[639,15174+11]..[639,15174+14]) + expression (test/basicStructures.t/input.re[639,15174+16]..[639,15174+17]) + Pexp_constant PConst_int (1,None) + "Foo.foo" (test/basicStructures.t/input.re[639,15174+19]..[639,15174+26]) + expression (test/basicStructures.t/input.re[639,15174+28]..[639,15174+31]) + Pexp_ident "foo" (test/basicStructures.t/input.re[639,15174+28]..[639,15174+31]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[640,15208+0]..[640,15208+38]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[640,15208+4]..[640,15208+7]) + Ppat_var "bar" (test/basicStructures.t/input.re[640,15208+4]..[640,15208+7]) + expression (test/basicStructures.t/input.re[640,15208+10]..[640,15208+38]) + Pexp_record + [ + "Foo.foo" (test/basicStructures.t/input.re[640,15208+11]..[640,15208+18]) + expression (test/basicStructures.t/input.re[640,15208+20]..[640,15208+23]) + Pexp_ident "foo" (test/basicStructures.t/input.re[640,15208+20]..[640,15208+23]) + "Bar.bar" (test/basicStructures.t/input.re[640,15208+25]..[640,15208+32]) + expression (test/basicStructures.t/input.re[640,15208+34]..[640,15208+37]) + Pexp_ident "bar" (test/basicStructures.t/input.re[640,15208+34]..[640,15208+37]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[642,15249+0]..[642,15249+25]) + Pstr_eval + expression (test/basicStructures.t/input.re[642,15249+0]..[642,15249+25]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[642,15249+5]..[642,15249+19]) + Ppat_record Closed + [ + "M.x" (test/basicStructures.t/input.re[642,15249+6]..[642,15249+9]) + pattern (test/basicStructures.t/input.re[642,15249+11]..[642,15249+12]) + Ppat_var "x" (test/basicStructures.t/input.re[642,15249+11]..[642,15249+12]) + "y" (test/basicStructures.t/input.re[642,15249+14]..[642,15249+15]) + pattern (test/basicStructures.t/input.re[642,15249+17]..[642,15249+18]) + Ppat_var "y" (test/basicStructures.t/input.re[642,15249+17]..[642,15249+18]) + ] + expression (test/basicStructures.t/input.re[642,15249+24]..[642,15249+25]) + Pexp_constant PConst_int (1,None) + structure_item (test/basicStructures.t/input.re[644,15277+0]..[646,15314+1]) + Pstr_eval + expression (test/basicStructures.t/input.re[644,15277+0]..[646,15314+1]) + Pexp_match + expression (test/basicStructures.t/input.re[644,15277+7]..[644,15277+12]) + Pexp_ident "foo" (test/basicStructures.t/input.re[644,15277+8]..[644,15277+11]) + [ + + pattern (test/basicStructures.t/input.re[645,15292+0]..[645,15292+16]) + Ppat_record Closed + [ + "y" (test/basicStructures.t/input.re[645,15292+3]..[645,15292+4]) + pattern (test/basicStructures.t/input.re[645,15292+6]..[645,15292+7]) + Ppat_constant PConst_int (1,None) + "M.x" (test/basicStructures.t/input.re[645,15292+9]..[645,15292+12]) + pattern (test/basicStructures.t/input.re[645,15292+14]..[645,15292+15]) + Ppat_var "x" (test/basicStructures.t/input.re[645,15292+14]..[645,15292+15]) + ] + expression (test/basicStructures.t/input.re[645,15292+20]..[645,15292+21]) + Pexp_constant PConst_int (2,None) + ] + structure_item (test/basicStructures.t/input.re[649,15342+0]..[649,15342+62]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[649,15342+4]..[649,15342+21]) + Ppat_var "break_after_equal" (test/basicStructures.t/input.re[649,15342+4]..[649,15342+21]) + expression (test/basicStructures.t/input.re[649,15342+24]..[649,15342+62]) + Pexp_apply + expression (test/basicStructures.t/input.re[649,15342+24]..[649,15342+42]) + Pexp_ident "no_break_from_here" (test/basicStructures.t/input.re[649,15342+24]..[649,15342+42]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[649,15342+43]..[649,15342+61]) + Pexp_apply + expression (test/basicStructures.t/input.re[649,15342+43]..[649,15342+52]) + Pexp_ident "some_call" (test/basicStructures.t/input.re[649,15342+43]..[649,15342+52]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[649,15342+53]..[649,15342+60]) + Pexp_ident "to_here" (test/basicStructures.t/input.re[649,15342+53]..[649,15342+60]) + ] + ] + ] + structure_item (test/basicStructures.t/input.re[652,15431+0]..[655,15468+1]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[652,15431+4]..[652,15431+6]) + Ppat_construct "()" (test/basicStructures.t/input.re[652,15431+4]..[652,15431+6]) + None + expression (test/basicStructures.t/input.re[652,15431+9]..[655,15468+1]) + attribute "reason.preserve_braces" + [] + Pexp_letexception + extension_constructor (test/basicStructures.t/input.re[653,15442+12]..[653,15442+13]) + pext_name = "E" + pext_kind = + Pext_decl + [] + None + expression (test/basicStructures.t/input.re[654,15457+2]..[654,15457+10]) + Pexp_apply + expression (test/basicStructures.t/input.re[654,15457+2]..[654,15457+7]) + Pexp_ident "raise" (test/basicStructures.t/input.re[654,15457+2]..[654,15457+7]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[654,15457+8]..[654,15457+9]) + Pexp_construct "E" (test/basicStructures.t/input.re[654,15457+8]..[654,15457+9]) + None + ] + ] + structure_item (test/basicStructures.t/input.re[658,15557+0]..[658,15557+32]) + Pstr_eval + expression (test/basicStructures.t/input.re[658,15557+0]..[658,15557+32]) + Pexp_record + [ + "contents" (test/basicStructures.t/input.re[658,15557+1]..[658,15557+9]) + expression (test/basicStructures.t/input.re[658,15557+11]..[658,15557+31]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[658,15557+15]..[658,15557+17]) + Ppat_construct "()" (test/basicStructures.t/input.re[658,15557+15]..[658,15557+17]) + None + expression (test/basicStructures.t/input.re[658,15557+21]..[658,15557+31]) + Pexp_constraint + expression (test/basicStructures.t/input.re[658,15557+22]..[658,15557+24]) + Pexp_construct "()" (test/basicStructures.t/input.re[658,15557+22]..[658,15557+24]) + None + core_type (test/basicStructures.t/input.re[658,15557+26]..[658,15557+30]) + Ptyp_constr "unit" (test/basicStructures.t/input.re[658,15557+26]..[658,15557+30]) + [] + ] + None + structure_item (test/basicStructures.t/input.re[661,15636+0]..[661,15636+31]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[661,15636+4]..[661,15636+5]) + Ppat_var "z" (test/basicStructures.t/input.re[661,15636+4]..[661,15636+5]) + expression (test/basicStructures.t/input.re[661,15636+8]..[661,15636+31]) + Pexp_record + [ + "a" (test/basicStructures.t/input.re[661,15636+9]..[661,15636+10]) + expression (test/basicStructures.t/input.re[661,15636+12]..[661,15636+24]) + Pexp_record + [ + "b" (test/basicStructures.t/input.re[661,15636+13]..[661,15636+14]) + expression (test/basicStructures.t/input.re[661,15636+16]..[661,15636+17]) + Pexp_ident "c" (test/basicStructures.t/input.re[661,15636+16]..[661,15636+17]) + "d" (test/basicStructures.t/input.re[661,15636+19]..[661,15636+20]) + expression (test/basicStructures.t/input.re[661,15636+22]..[661,15636+23]) + Pexp_ident "e" (test/basicStructures.t/input.re[661,15636+22]..[661,15636+23]) + ] + None + "f" (test/basicStructures.t/input.re[661,15636+26]..[661,15636+27]) + expression (test/basicStructures.t/input.re[661,15636+29]..[661,15636+30]) + Pexp_ident "g" (test/basicStructures.t/input.re[661,15636+29]..[661,15636+30]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[663,15670+0]..[663,15670+35]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[663,15670+4]..[663,15670+5]) + Ppat_var "z" (test/basicStructures.t/input.re[663,15670+4]..[663,15670+5]) + expression (test/basicStructures.t/input.re[663,15670+8]..[663,15670+35]) + Pexp_record + [ + "a" (test/basicStructures.t/input.re[663,15670+9]..[663,15670+10]) + expression (test/basicStructures.t/input.re[663,15670+12]..[663,15670+28]) + Pexp_extension "bs.obj" + [ + structure_item (test/basicStructures.t/input.re[663,15670+12]..[663,15670+28]) + Pstr_eval + expression (test/basicStructures.t/input.re[663,15670+12]..[663,15670+28]) + Pexp_record + [ + "b" (test/basicStructures.t/input.re[663,15670+13]..[663,15670+20]) + expression (test/basicStructures.t/input.re[663,15670+18]..[663,15670+19]) + Pexp_ident "c" (test/basicStructures.t/input.re[663,15670+18]..[663,15670+19]) + "d" (test/basicStructures.t/input.re[663,15670+21]..[663,15670+27]) + expression (test/basicStructures.t/input.re[663,15670+26]..[663,15670+27]) + Pexp_ident "e" (test/basicStructures.t/input.re[663,15670+26]..[663,15670+27]) + ] + None + ] + "f" (test/basicStructures.t/input.re[663,15670+30]..[663,15670+31]) + expression (test/basicStructures.t/input.re[663,15670+33]..[663,15670+34]) + Pexp_ident "g" (test/basicStructures.t/input.re[663,15670+33]..[663,15670+34]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[665,15708+0]..[665,15708+41]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[665,15708+4]..[665,15708+5]) + Ppat_var "z" (test/basicStructures.t/input.re[665,15708+4]..[665,15708+5]) + expression (test/basicStructures.t/input.re[665,15708+8]..[665,15708+41]) + Pexp_record + [ + "a" (test/basicStructures.t/input.re[665,15708+9]..[665,15708+10]) + expression (test/basicStructures.t/input.re[665,15708+12]..[665,15708+34]) + Pexp_object + class_structure + pattern (test/basicStructures.t/input.re[665,15708+13]..[665,15708+13]) + Ppat_var "this" (test/basicStructures.t/input.re[665,15708+13]..[665,15708+13]) + [ + class_field (test/basicStructures.t/input.re[665,15708+13]..[665,15708+22]) + Pcf_method Public + "b" (test/basicStructures.t/input.re[665,15708+17]..[665,15708+18]) + Concrete Fresh + expression (test/basicStructures.t/input.re[665,15708+17]..[665,15708+22]) ghost + Pexp_poly + expression (test/basicStructures.t/input.re[665,15708+21]..[665,15708+22]) + Pexp_ident "c" (test/basicStructures.t/input.re[665,15708+21]..[665,15708+22]) + None + class_field (test/basicStructures.t/input.re[665,15708+24]..[665,15708+33]) + Pcf_method Public + "d" (test/basicStructures.t/input.re[665,15708+28]..[665,15708+29]) + Concrete Fresh + expression (test/basicStructures.t/input.re[665,15708+28]..[665,15708+33]) ghost + Pexp_poly + expression (test/basicStructures.t/input.re[665,15708+32]..[665,15708+33]) + Pexp_ident "e" (test/basicStructures.t/input.re[665,15708+32]..[665,15708+33]) + None + ] + "f" (test/basicStructures.t/input.re[665,15708+36]..[665,15708+37]) + expression (test/basicStructures.t/input.re[665,15708+39]..[665,15708+40]) + Pexp_ident "g" (test/basicStructures.t/input.re[665,15708+39]..[665,15708+40]) + ] + None + ] + structure_item (test/basicStructures.t/input.re[667,15752+0]..[667,15752+39]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[667,15752+4]..[667,15752+5]) + Ppat_var "z" (test/basicStructures.t/input.re[667,15752+4]..[667,15752+5]) + expression (test/basicStructures.t/input.re[667,15752+8]..[667,15752+39]) + Pexp_extension "bs.obj" + [ + structure_item (test/basicStructures.t/input.re[667,15752+8]..[667,15752+39]) + Pstr_eval + expression (test/basicStructures.t/input.re[667,15752+8]..[667,15752+39]) + Pexp_record + [ + "a" (test/basicStructures.t/input.re[667,15752+9]..[667,15752+31]) + expression (test/basicStructures.t/input.re[667,15752+14]..[667,15752+30]) + Pexp_extension "bs.obj" + [ + structure_item (test/basicStructures.t/input.re[667,15752+14]..[667,15752+30]) + Pstr_eval + expression (test/basicStructures.t/input.re[667,15752+14]..[667,15752+30]) + Pexp_record + [ + "b" (test/basicStructures.t/input.re[667,15752+15]..[667,15752+22]) + expression (test/basicStructures.t/input.re[667,15752+20]..[667,15752+21]) + Pexp_ident "c" (test/basicStructures.t/input.re[667,15752+20]..[667,15752+21]) + "d" (test/basicStructures.t/input.re[667,15752+23]..[667,15752+29]) + expression (test/basicStructures.t/input.re[667,15752+28]..[667,15752+29]) + Pexp_ident "e" (test/basicStructures.t/input.re[667,15752+28]..[667,15752+29]) + ] + None + ] + "f" (test/basicStructures.t/input.re[667,15752+32]..[667,15752+38]) + expression (test/basicStructures.t/input.re[667,15752+37]..[667,15752+38]) + Pexp_ident "g" (test/basicStructures.t/input.re[667,15752+37]..[667,15752+38]) + ] + None + ] + ] + structure_item (test/basicStructures.t/input.re[669,15794+0]..[669,15794+35]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[669,15794+4]..[669,15794+5]) + Ppat_var "z" (test/basicStructures.t/input.re[669,15794+4]..[669,15794+5]) + expression (test/basicStructures.t/input.re[669,15794+8]..[669,15794+35]) + Pexp_extension "bs.obj" + [ + structure_item (test/basicStructures.t/input.re[669,15794+8]..[669,15794+35]) + Pstr_eval + expression (test/basicStructures.t/input.re[669,15794+8]..[669,15794+35]) + Pexp_record + [ + "a" (test/basicStructures.t/input.re[669,15794+9]..[669,15794+27]) + expression (test/basicStructures.t/input.re[669,15794+14]..[669,15794+26]) + Pexp_record + [ + "b" (test/basicStructures.t/input.re[669,15794+15]..[669,15794+16]) + expression (test/basicStructures.t/input.re[669,15794+18]..[669,15794+19]) + Pexp_ident "c" (test/basicStructures.t/input.re[669,15794+18]..[669,15794+19]) + "d" (test/basicStructures.t/input.re[669,15794+21]..[669,15794+22]) + expression (test/basicStructures.t/input.re[669,15794+24]..[669,15794+25]) + Pexp_ident "e" (test/basicStructures.t/input.re[669,15794+24]..[669,15794+25]) + ] + None + "f" (test/basicStructures.t/input.re[669,15794+28]..[669,15794+34]) + expression (test/basicStructures.t/input.re[669,15794+33]..[669,15794+34]) + Pexp_ident "g" (test/basicStructures.t/input.re[669,15794+33]..[669,15794+34]) + ] + None + ] + ] + structure_item (test/basicStructures.t/input.re[671,15832+0]..[671,15832+45]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[671,15832+4]..[671,15832+5]) + Ppat_var "z" (test/basicStructures.t/input.re[671,15832+4]..[671,15832+5]) + expression (test/basicStructures.t/input.re[671,15832+8]..[671,15832+45]) + Pexp_extension "bs.obj" + [ + structure_item (test/basicStructures.t/input.re[671,15832+8]..[671,15832+45]) + Pstr_eval + expression (test/basicStructures.t/input.re[671,15832+8]..[671,15832+45]) + Pexp_record + [ + "a" (test/basicStructures.t/input.re[671,15832+9]..[671,15832+37]) + expression (test/basicStructures.t/input.re[671,15832+14]..[671,15832+36]) + Pexp_object + class_structure + pattern (test/basicStructures.t/input.re[671,15832+15]..[671,15832+15]) + Ppat_var "this" (test/basicStructures.t/input.re[671,15832+15]..[671,15832+15]) + [ + class_field (test/basicStructures.t/input.re[671,15832+15]..[671,15832+24]) + Pcf_method Public + "b" (test/basicStructures.t/input.re[671,15832+19]..[671,15832+20]) + Concrete Fresh + expression (test/basicStructures.t/input.re[671,15832+19]..[671,15832+24]) ghost + Pexp_poly + expression (test/basicStructures.t/input.re[671,15832+23]..[671,15832+24]) + Pexp_ident "c" (test/basicStructures.t/input.re[671,15832+23]..[671,15832+24]) + None + class_field (test/basicStructures.t/input.re[671,15832+26]..[671,15832+35]) + Pcf_method Public + "d" (test/basicStructures.t/input.re[671,15832+30]..[671,15832+31]) + Concrete Fresh + expression (test/basicStructures.t/input.re[671,15832+30]..[671,15832+35]) ghost + Pexp_poly + expression (test/basicStructures.t/input.re[671,15832+34]..[671,15832+35]) + Pexp_ident "e" (test/basicStructures.t/input.re[671,15832+34]..[671,15832+35]) + None + ] + "f" (test/basicStructures.t/input.re[671,15832+38]..[671,15832+44]) + expression (test/basicStructures.t/input.re[671,15832+43]..[671,15832+44]) + Pexp_ident "g" (test/basicStructures.t/input.re[671,15832+43]..[671,15832+44]) + ] + None + ] + ] + structure_item (test/basicStructures.t/input.re[674,15881+0]..[677,15930+27]) ghost + Pstr_value Nonrec + [ + + attribute "ocaml.doc" + [ + structure_item (test/basicStructures.t/input.re[674,15881+0]..[676,15926+3]) + Pstr_eval + expression (test/basicStructures.t/input.re[674,15881+0]..[676,15926+3]) + Pexp_constant PConst_string("\n * Unnecessary parens should be removed.\n ",(test/basicStructures.t/input.re[674,15881+0]..[676,15926+3]),None) + ] + pattern (test/basicStructures.t/input.re[677,15930+4]..[677,15930+14]) + Ppat_var "unitLambda" (test/basicStructures.t/input.re[677,15930+4]..[677,15930+14]) + expression (test/basicStructures.t/input.re[677,15930+17]..[677,15930+27]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[677,15930+18]..[677,15930+20]) + Ppat_construct "()" (test/basicStructures.t/input.re[677,15930+18]..[677,15930+20]) + None + expression (test/basicStructures.t/input.re[677,15930+25]..[677,15930+27]) + Pexp_construct "()" (test/basicStructures.t/input.re[677,15930+25]..[677,15930+27]) + None + ] + structure_item (test/basicStructures.t/input.re[678,15959+0]..[678,15959+32]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[678,15959+4]..[678,15959+20]) + Ppat_var "identifierLambda" (test/basicStructures.t/input.re[678,15959+4]..[678,15959+20]) + expression (test/basicStructures.t/input.re[678,15959+23]..[678,15959+32]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[678,15959+24]..[678,15959+25]) + Ppat_var "a" (test/basicStructures.t/input.re[678,15959+24]..[678,15959+25]) + expression (test/basicStructures.t/input.re[678,15959+30]..[678,15959+32]) + Pexp_construct "()" (test/basicStructures.t/input.re[678,15959+30]..[678,15959+32]) + None + ] + structure_item (test/basicStructures.t/input.re[679,15993+0]..[679,15993+32]) ghost + Pstr_value Nonrec + [ + + pattern (test/basicStructures.t/input.re[679,15993+4]..[679,15993+20]) + Ppat_var "underscoreLambda" (test/basicStructures.t/input.re[679,15993+4]..[679,15993+20]) + expression (test/basicStructures.t/input.re[679,15993+23]..[679,15993+32]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[679,15993+24]..[679,15993+25]) + Ppat_any + expression (test/basicStructures.t/input.re[679,15993+30]..[679,15993+32]) + Pexp_construct "()" (test/basicStructures.t/input.re[679,15993+30]..[679,15993+32]) + None + ] + structure_item (test/basicStructures.t/input.re[680,16027+0]..[683,16127+2]) + Pstr_eval + expression (test/basicStructures.t/input.re[680,16027+0]..[683,16127+2]) + Pexp_apply + expression (test/basicStructures.t/input.re[680,16027+0]..[680,16027+2]) + Pexp_ident "it" (test/basicStructures.t/input.re[680,16027+0]..[680,16027+2]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[680,16027+3]..[680,16027+25]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("should remove parens",(test/basicStructures.t/input.re[680,16027+3]..[680,16027+25]),None) + ] + Pexp_constant PConst_string("should remove parens",(test/basicStructures.t/input.re[680,16027+3]..[680,16027+25]),None) + + Nolabel + expression (test/basicStructures.t/input.re[680,16027+27]..[683,16127+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[680,16027+28]..[680,16027+29]) + Ppat_var "a" (test/basicStructures.t/input.re[680,16027+28]..[680,16027+29]) + expression (test/basicStructures.t/input.re[680,16027+34]..[683,16127+1]) + attribute "reason.preserve_braces" + [] + Pexp_sequence + expression (test/basicStructures.t/input.re[681,16063+2]..[681,16063+30]) + Pexp_apply + expression (test/basicStructures.t/input.re[681,16063+2]..[681,16063+14]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[681,16063+2]..[681,16063+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[681,16063+15]..[681,16063+29]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("did it work?",(test/basicStructures.t/input.re[681,16063+15]..[681,16063+29]),None) + ] + Pexp_constant PConst_string("did it work?",(test/basicStructures.t/input.re[681,16063+15]..[681,16063+29]),None) + ] + expression (test/basicStructures.t/input.re[682,16095+2]..[682,16095+31]) + Pexp_apply + expression (test/basicStructures.t/input.re[682,16095+2]..[682,16095+14]) + Pexp_ident "print_string" (test/basicStructures.t/input.re[682,16095+2]..[682,16095+14]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[682,16095+15]..[682,16095+29]) + attribute "reason.raw_literal" + [ + structure_item (_none_[0,0+-1]..[0,0+-1]) ghost + Pstr_eval + expression (_none_[0,0+-1]..[0,0+-1]) ghost + Pexp_constant PConst_string("did it work?",(test/basicStructures.t/input.re[682,16095+15]..[682,16095+29]),None) + ] + Pexp_constant PConst_string("did it work?",(test/basicStructures.t/input.re[682,16095+15]..[682,16095+29]),None) + ] + ] + structure_item (test/basicStructures.t/input.re[686,16185+0]..[686,16185+22]) + Pstr_eval + expression (test/basicStructures.t/input.re[686,16185+0]..[686,16185+22]) + Pexp_apply + expression (test/basicStructures.t/input.re[686,16185+10]..[686,16185+12]) + Pexp_ident "##" (test/basicStructures.t/input.re[686,16185+10]..[686,16185+12]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[686,16185+0]..[686,16185+10]) + Pexp_apply + expression (test/basicStructures.t/input.re[686,16185+8]..[686,16185+9]) + Pexp_ident "!" (test/basicStructures.t/input.re[686,16185+8]..[686,16185+9]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[686,16185+1]..[686,16185+8]) + Pexp_ident "curNode" (test/basicStructures.t/input.re[686,16185+1]..[686,16185+8]) + ] + + Nolabel + expression (test/basicStructures.t/input.re[686,16185+12]..[686,16185+22]) + Pexp_ident "childNodes" (test/basicStructures.t/input.re[686,16185+12]..[686,16185+22]) + ] + structure_item (test/basicStructures.t/input.re[688,16210+0]..[690,16247+2]) + Pstr_eval + expression (test/basicStructures.t/input.re[688,16210+0]..[690,16247+2]) + Pexp_apply + expression (test/basicStructures.t/input.re[688,16210+0]..[688,16210+3]) + Pexp_ident "foo" (test/basicStructures.t/input.re[688,16210+0]..[688,16210+3]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[688,16210+4]..[690,16247+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[688,16210+4]..[688,16210+18]) + Ppat_var "preserveBraces" (test/basicStructures.t/input.re[688,16210+4]..[688,16210+18]) + expression (test/basicStructures.t/input.re[688,16210+22]..[690,16247+1]) + attribute "reason.preserve_braces" + [] + Pexp_ident "inCallback" (test/basicStructures.t/input.re[689,16234+2]..[689,16234+12]) + ] + structure_item (test/basicStructures.t/input.re[692,16252+0]..[694,16289+13]) + Pstr_eval + expression (test/basicStructures.t/input.re[692,16252+0]..[694,16289+13]) + Pexp_apply + expression (test/basicStructures.t/input.re[692,16252+0]..[692,16252+3]) + Pexp_ident "foo" (test/basicStructures.t/input.re[692,16252+0]..[692,16252+3]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[692,16252+4]..[694,16289+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[692,16252+4]..[692,16252+18]) + Ppat_var "preserveBraces" (test/basicStructures.t/input.re[692,16252+4]..[692,16252+18]) + expression (test/basicStructures.t/input.re[692,16252+22]..[694,16289+1]) + attribute "reason.preserve_braces" + [] + Pexp_ident "inFirstPos" (test/basicStructures.t/input.re[693,16276+2]..[693,16276+12]) + + Nolabel + expression (test/basicStructures.t/input.re[694,16289+3]..[694,16289+12]) + Pexp_ident "secondArg" (test/basicStructures.t/input.re[694,16289+3]..[694,16289+12]) + ] + structure_item (test/basicStructures.t/input.re[696,16305+0]..[698,16350+13]) + Pstr_eval + expression (test/basicStructures.t/input.re[696,16305+0]..[698,16350+13]) + Pexp_apply + expression (test/basicStructures.t/input.re[696,16305+0]..[696,16305+3]) + Pexp_ident "foo" (test/basicStructures.t/input.re[696,16305+0]..[696,16305+3]) + [ + + Nolabel + expression (test/basicStructures.t/input.re[696,16305+4]..[696,16305+10]) + Pexp_ident "oneArg" (test/basicStructures.t/input.re[696,16305+4]..[696,16305+10]) + + Nolabel + expression (test/basicStructures.t/input.re[696,16305+12]..[698,16350+1]) + Pexp_fun + Nolabel + None + pattern (test/basicStructures.t/input.re[696,16305+12]..[696,16305+26]) + Ppat_var "preserveBraces" (test/basicStructures.t/input.re[696,16305+12]..[696,16305+26]) + expression (test/basicStructures.t/input.re[696,16305+30]..[698,16350+1]) + attribute "reason.preserve_braces" + [] + Pexp_ident "inFirstPos" (test/basicStructures.t/input.re[697,16337+2]..[697,16337+12]) + + Nolabel + expression (test/basicStructures.t/input.re[698,16350+3]..[698,16350+12]) + Pexp_ident "secondArg" (test/basicStructures.t/input.re[698,16350+3]..[698,16350+12]) + ] +] diff --git a/test/basicStructures.t/run.t.new b/test/basicStructures.t/run.t.new index f1a30d458..13c300167 100644 --- a/test/basicStructures.t/run.t.new +++ b/test/basicStructures.t/run.t.new @@ -1,58 +1,77 @@ -let run = => todo pexident("Basic Structures"); +let run = () => { + TestUtils.printSection("Basic Structures") +}; -todo Pexp_while; +while (something) { + print_string("You're in a while loop"); + print_newline(()) +}; -todo Pexp_for; +for (i in 0 to 5) { + print_int(i); + print_newline(()); + for (i in 10 downto 0) { + print_string("Counting in reverse direction"); + print_newline(()) + } +}; -todo Pexp_for; +for (i in 0 to expr endOfRangeMustBeSimple soWrap) { + print_int(i); + print_newline(()); + for (i in theSame(isTrue, ofThe, startOfRange) downto 0) { + print_string("Counting in reverse direction"); + print_newline(()) + } +}; -let x = !(todo Pexp_field); +let x = (!)(todo Pexp_field; -let x = !(todo Pexp_field); +let x = (!)(todo Pexp_field; -let x = !(todo Pexp_send); +let x = (!)(todo Pexp_send; -let x = !(todo Pexp_field); +let x = (!)(todo Pexp_field; -let x = !(todo Pexp_send); +let x = (!)(todo Pexp_send; -let x = not(todo Pexp_field); +let x = not(todo Pexp_field; -let x = not(todo Pexp_field); +let x = not(todo Pexp_field; -let x = not(todo Pexp_send); +let x = not(todo Pexp_send; -let x = not(todo Pexp_field); +let x = not(todo Pexp_field; -let x = not(todo Pexp_send); +let x = not(todo Pexp_send; -let x = not(not(todo Pexp_field)); +let x = not(not(todo Pexp_field; -let x = ?!(not(todo Pexp_field)); +let x = (?!)(not(todo Pexp_field; -let x = not(?!(todo Pexp_field)); +let x = not((?!)(todo Pexp_field; -let x = ~!(not(todo Pexp_field)); +let x = (~!)(not(todo Pexp_field; -let x = not(~!(todo Pexp_field)); +let x = not((~!)(todo Pexp_field; -let x = ~!(~!(todo Pexp_field)); +let x = (~!)((~!)(todo Pexp_field; -let x = !!(todo Pexp_field); +let x = (!!)(todo Pexp_field; -let x = !!(todo Pexp_send); +let x = (!!)(todo Pexp_send; -let x = !~(todo Pexp_field); +let x = (!~)(todo Pexp_field; -let x = !~(todo Pexp_send); +let x = (!~)(todo Pexp_send; -let noParensNeeded = not(todo Pexp_field); +let noParensNeeded = not(todo Pexp_field; let parensNeededAroundFirst = todo Pexp_field; let parensNeededAroundSecond = todo Pexp_field; -let noParensNeeded = not(todo Pexp_send); +let noParensNeeded = not(todo Pexp_send; let parensNeededAroundFirst = todo Pexp_send; @@ -66,9 +85,9 @@ let parensWithSpaceNeededAroundFirst = todo Pexp_send; let parensWithSpaceNeededAroundSecond = todo Pexp_send; -let x = not(not(todo Pexp_field)); +let x = not(not(todo Pexp_field; -let x = not(not(todo Pexp_send)); +let x = not(not(todo Pexp_send; let x = -10; @@ -98,23 +117,23 @@ let todo: Ppat_lazy = 10; let todo: Ppat_lazy = 10; -let x = todo pexident(!(arr), 0); +let x = Array.get((!)(arr,0; -let x = todo pexident(!(arr), 0); +let x = Array.get((!)(arr,0; -let x = todo pexident(!(str), 0); +let x = String.get((!)(str,0; -let x = todo pexident(!(str), 0); +let x = String.get((!)(str,0; -let x = todo pexident(!(arr), 0, 1); +let x = Array.set((!)(arr,0,1; -let x = todo pexident(!(arr), 0, 1); +let x = Array.set((!)(arr,0,1; todo Pstr_attribute todo Pstr_attribute -let /++ = +; +let /++ = (+); let something = todo Pexp_ifthenelse; @@ -132,7 +151,8 @@ todo Pexp_setfield; todo Pexp_setfield; -let loop = (appTime, frameTime) => todo Pexp_sequence; +let loop = (appTime, frameTime) => todo Pexp_ifthenelse; +appTime process frameTime; todo Pexp_ifthenelse; @@ -196,7 +216,7 @@ let annotatingFuncApplication = ( let annotatingSingleFuncApplication = ( _dummyFunc( - "a", + "a" ): int); let annotatingSingleFuncApplication = @@ -221,38 +241,26 @@ let moreTrailing = (1, 2, 3, 4, 5, 7); todo Pstr_attribute -let x = (::( - 1, - ::( - 2, - ::( - 3, - ::(4, ::(5, ::(6, ::(7, ::(8, ::(9, [])))))), - ), - ), -): list(int)); +let x = (Pexp_construct list: list(int)); let hd = "appendedToHead"; -let tl = ::("listTo", ::("append", ::("to", []))); +let tl = Pexp_construct list; -let result = (::(hd, tl): list(string)); +let result = (Pexp_construct cons: list(string)); -let result = (::( - "appendedToHead", - ::("listTo", ::("append", ::("to", []))), -): list(string)); +let result = (Pexp_construct list: list(string)); let recsize = ( fun | [] => 0 - | [hd, ...tl] => 1 + size(tl) + | [hd, ...tl] => 1 + size(tl ); let recsize = (soFar, lst) => switch (lst) { | [] => 0 -| [hd, ...tl] => size(soFar + 1, tl) +| [hd, ...tl] => soFar + 1 size tl }; let nestedMatch = lstLst => @@ -310,17 +318,17 @@ let arrayWithOne = todo Pexp_array; let arrayWithTwo = todo Pexp_array; -let secondItem = todo pexident(arrayWithTwo, 1); +let secondItem = Array.get(arrayWithTwo,1; -let secondItem = todo pexident(arrayWithTwo, 1); +let secondItem = Array.get(arrayWithTwo,1; -todo pexident(arrayWithTwo, 1, 300); +Array.set(arrayWithTwo,1,300; todo Pstr_attribute let myString = "asdf"; -todo pexident(myString, 2, '9'); +String.set(myString,2,'9'; let one = 900; @@ -345,9 +353,9 @@ let myFunction = ((a: int), (b: int)) => (a + b: int); let functionReturnValueType = ((i: int), (s: string)) => (x => x + 1: other type...); -let curriedFormOne = ((i: int), (s: string)) => s ^ +let curriedFormOne = ((i: int), (s: string)) => s (^) string_of_int( - i, + i ); let curriedFormTwo = ((i: int), (x: int)) => (( @@ -404,7 +412,7 @@ let anotherRecord = { age: todo Pexp_field + 10, }; -let makeRecordBase = => { +let makeRecordBase = () => { name: "Joe", age: 30, occupation: "Engineer", @@ -481,7 +489,9 @@ type description = { tag: tag(todo a), }; -todo Pstr_module +module Foo = {type bar = { + foo: other type..., +};}; type foo = { bar: other type..., @@ -489,17 +499,13 @@ type foo = { fooo: other type..., }; -let moreFoo = { - bar: todo pexident, - qux, - fooo: todo pexident, -}; +let moreFoo = {bar: Baz.bar, qux, fooo: Fooo.fooo}; let props = {title: "hi"}; let componentA = {props}; -let componentB = {props, state: }; +let componentB = {props, state: ()}; let foo = {Ppat_record: not supported}; @@ -521,12 +527,12 @@ switch (foo) { let break_after_equal = no_break_from_here( - some_call(to_here), + some_call(to_here) ); -let = todo Pexp_letexception; +let () = todo Pexp_letexception; -{contents: => (: unit)}; +{contents: () => ((): unit)}; let z = {a: {b: c, d: e}, f: g}; @@ -543,27 +549,28 @@ let z = todo Pexp_extension; /** * Unnecessary parens should be removed. */ -let unitLambda = => ; - -let identifierLambda = a => ; +let unitLambda = () => (); -let underscoreLambda = _ => ; +let identifierLambda = a => (); +let underscoreLambda = _ => (); -it( - "should remove parens", - a => todo Pexp_sequence, -); +"should remove parens" it a => { + print_string("did it work?"); + print_string("did it work?") +}; -!(curNode) ## childNodes; +(!)(curNode ## childNodes; -foo(preserveBraces => inCallback); +foo(preserveBraces => { inCallback}; -foo(preserveBraces => inFirstPos, secondArg); +preserveBraces => { inFirstPos} foo secondArg; foo( oneArg, - preserveBraces => inFirstPos, + preserveBraces => { + inFirstPos + }, secondArg, ); diff --git a/test/patternMatching.t/run.t.new b/test/patternMatching.t/run.t.new new file mode 100644 index 000000000..74d5b82e3 --- /dev/null +++ b/test/patternMatching.t/run.t.new @@ -0,0 +1,326 @@ +type point = { + x: int, + y: int, +}; + +let id = x => x; + +type myVariant = + | TwoCombos(inner, inner) + | Short + | AlsoHasARecord(int, int, point) +and inner = + | Unused + | HeresTwoConstructorArguments(int, int); + +let computeTuple = (a, b, c, d, e, f, g, h) => ( + a + b, + c + d, + e + f, + g + h, +); + +let res = + switch (TwoCombos(Unused, Unused)) { + | TwoCombos( + HeresTwoConstructorArguments(x, y), + HeresTwoConstructorArguments(a, b), + ) => ( + x, + y, + a, + b, + ) + | TwoCombos(_, _) => (0, 0, 0, 0) + | Short + | AlsoHasARecord(300, _, _) => ( + 100000, + 100000, + 100000, + 100000, + ) + | AlsoHasARecord(firstItem, two, {x, y}) => + computeTuple( + firstItem, + firstItem, + firstItem, + firstItem, + firstItem, + two, + two, + two, + ) + }; + +/** + * Match bodies may include sequence expressions, but without the `{}` + * braces required. + */ +let res = + switch (TwoCombos(Unused, Unused)) { + | TwoCombos( + HeresTwoConstructorArguments(x, y), + HeresTwoConstructorArguments(a, b), + ) => + let ret = (x, y, a, b); + ret; + | TwoCombos(_, _) => + /** + * See, no braces required - saves indentation as well! + */ + let ret = (0, 0, 0, 0); + ret; + | Short + | AlsoHasARecord(300, _, _) => + /** + * And no final semicolon is required. + */ + let ret = (100000, 100000, 100000, 100000); + ret; + | AlsoHasARecord(firstItem, two, {x, y}) => + computeTuple( + firstItem, + firstItem, + firstItem, + firstItem, + firstItem, + two, + two, + two, + ) + }; + +/** + * Ensure that nested Pexp_functions are correctly wrapped in parens. + * + */ +let res = + switch (TwoCombos(Unused, Unused)) { + | TwoCombos( + HeresTwoConstructorArguments(x, y), + HeresTwoConstructorArguments(a, b), + ) => fun + | Some(x) => x + 1 + | None => 0 + | TwoCombos(_, _) => + let x = ( + fun + | Some(x) => x + 1 + | None => 0 + ); + x; + | Short + | AlsoHasARecord(300, _, _) => + id( + fun + | Some(x) => x + 1 + | None => 0 + ) + | AlsoHasARecord(firstItem, two, {x, y}) => + id( + fun + | Some(x) => x + 1 + | None => 0 + ) + }; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + + +switch (Some(())) { +| Some(()) => 1 +| _ => 2 +}; + +type foo = | Foo(unit); + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (Foo(())) { +| Foo(()) => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (()) { +| () => 1 +}; + + +switch (Some(1)) { +| Some(1) => 1 +| None => 2 +| _ => 3 +}; + +let myInt = 100; + +[@something1 .. 2 +let rangeInt = 0; + +let myChar = 'x'; + +let rangeChar = + switch (myChar) { + | 'a' .. 'b' => "a to b" + | 'b' .. 'z' => "b to z" + | c => "something else" + }; + + +switch (None) { +| Some([]) => () +| Some([_]) when true => () +| Some([x]) => () +| Some([x, ...xs]) when true => () +| Some([x, y, z]) => () +| _ => () +}; + + +switch (None) { +| Some([]) => () +| Some([_]) when true => () +| Some([x]) => () +| Some([x, ...xs]) when true => () +| Some([x, y, z]) => () +| _ => () +}; + + +switch (None) { +| Some([||]) => "empty" +| Some([|_|]) when true => "one any" +| Some([|a|]) => "one" +| Some([|a, b|]) => "two" +| _ => "many" +}; + + +switch (None) { +| Some([||]) => "empty" +| Some([|_|]) when true => "one any" +| Some([|a|]) => "one" +| Some([|a, b|]) => "two" +| _ => "many" +}; + + +switch (None) { +| Some({x}) when true => () +| Some({x, y}) => () +| _ => () +}; + + +switch (None) { +| Some({x}) when true => () +| Some({x, y}) => () +| _ => () +}; + + +switch (None) { +| Some( + [|someSuperLongString, thisShouldBreakTheLine|], + ) => () +| _ => () +}; + + +switch (None) { +| Some( + (someSuperLongString, thisShouldBreakTheLine), + ) => () +| _ => () +}; + + +switch (None) { +| Some( + [someSuperLongString, thisShouldBreakTheLine], + ) => () +| Some( + [someSuperLongString, ...es6ListSugarLikeSyntaxWhichIsSuperLong], + ) when true == true => () +| Some( + [someSuperLongString, ...es6ListSugarLikeSyntaxWhichIsSuperLong], + ) => () +| _ => () +}; + +type aOrB = + | A(int) + | B(int); + +let ((nestedAnnotation: int): int) = 0; + +let (A(i) +| B(i): aOrB) = A(0); + +type test_foo = + | VariantType1 + | VariantType2; + +let branch_with_variant_and_annotation = ( + fun + | (VariantType1: test_foo) => true + | VariantType2 => false +); + +type intRange = { + from: option(string), + to_: option(string), +}; + +type optIntRange = option(intRange); + +let optIntRangeOfIntRange = ( + fun + | ({from: None, to_: None}: intRange) => (None: optIntRange) + | {from, to_} => Some({from, to_}) +); diff --git a/test/sequences.t/run.t.new b/test/sequences.t/run.t.new new file mode 100644 index 000000000..a87af7575 --- /dev/null +++ b/test/sequences.t/run.t.new @@ -0,0 +1,69 @@ +/** + * Testing Sequences. + */ +let result = +let twenty = 20; + +let result = twenty; +result;;; + +let result = let twenty = result; twenty;; + +let anInt = result + 20; + +let twenty = 20; + +/** + * Each of these are a sequence with a single item - they will be + * printed in reduced form because sequences are a *parse* time construct. + * To ensure these are parsed correctly, adding to an integer. + */ +let result = 0 + twenty; + +let result = 0 + twenty; + +let result = 0 + twenty; + +let unitValue = (); + +while (false) { unitValue }; + +while (false) { print_string("test" }; + +while (false) { print_string("test" }; + +type myRecord = { + number: int, +}; + +let x = {number: 20}; + +let number = 20; + +let cannotPunASingleFieldRecord = {number}; + +let fourty = 20 + todo Pexp_field; + +let thisIsASequenceNotPunedRecord = number; + +let fourty = 20 + thisIsASequenceNotPunedRecord; + +type recordType = { + a: int, + b: int, + c: int, +}; + +let a = 0; + +let b = 0; + +let c = 0; + +let firstFieldPunned = {a, b, c}; + +let sndFieldPunned = {a, b, c}; + +let thirdFieldPunned = {a, b, c}; + +let singlePunAcceptedIfExtended = {a}; From 9e1e253ba2f8785251d5d2252511015f30056cff Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Fri, 5 May 2023 13:24:42 +0200 Subject: [PATCH 09/13] wip --- src/reason-parser/reason_pprint_ast_pprint.ml | 58 ++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index 6627f67dc..82ed1d0d1 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -996,7 +996,7 @@ and protectIdentifier txt = in if not needs_parens then string txt else if needs_spaces txt then group (lparen ^^ string txt ^^ rparen) - else string ("(" ^ txt ^ ")") + else lparen ^^ string txt ^^ rparen and protectLongIdentifier longPrefix txt = group (longPrefix ^^ string "." ^^ protectIdentifier txt) @@ -1004,8 +1004,7 @@ and protectLongIdentifier longPrefix txt = and longident = function | Lident s -> protectIdentifier s | Ldot (longPrefix, s) -> protectLongIdentifier (longident longPrefix) s - | Lapply (y, s) -> - group (longident y ^^ string "(" ^^ longident s ^^ string ")") + | Lapply (y, s) -> group (longident y ^^ lparen ^^ longident s ^^ rparen) and constant c = let open OCaml in @@ -1061,18 +1060,36 @@ and expression ?(depth = 0) ?(wrap = true) x = arg_label a ^^ args ^^ arrow ^^ callback | Pexp_apply ( ({ pexp_desc = Pexp_ident { txt = Lident i; _ }; _ } as infixOperator), - [ (_, a); (_, b) ] ) -> ( + ([ (_, a); (_, b) ] as l) ) -> ( match printedStringAndFixity i with | Infix o -> expression a ^^ space ^^ string o ^^ space ^^ expression b + | Normal -> + (* this should be merged with Pexp_apply (e, l) *) + group + (ifflat + (expression infixOperator ^^ lparen + ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l + ^^ rparen) + (group + (break 0 ^^ expression infixOperator ^^ lparen + ^^ nest 2 + (break 0 + ^^ separate_map + (comma ^^ break 1) + (fun (_, e) -> expression ~wrap:false e) + l + ^^ ifflat empty + (if List.length l = 1 then empty else comma)) + ^^ break 0 ^^ rparen))) | _ -> expression a ^^ space ^^ expression infixOperator ^^ space ^^ expression b) | Pexp_apply (e, l) -> ifflat - (expression e ^^ string "(" + (expression e ^^ lparen ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l) (group - (break 0 ^^ expression e ^^ string "(" + (break 0 ^^ expression e ^^ lparen ^^ nest 2 (break 0 ^^ separate_map @@ -1080,7 +1097,7 @@ and expression ?(depth = 0) ?(wrap = true) x = (fun (_, e) -> expression ~wrap:false e) l ^^ ifflat empty (if List.length l = 1 then empty else comma)) - ^^ break 0 ^^ string ")")) + ^^ break 0 ^^ rparen)) | Pexp_match (e, cl) -> group (nest depth @@ -1128,22 +1145,37 @@ and expression ?(depth = 0) ?(wrap = true) x = | Pexp_field (e, l) -> string "todo Pexp_field" | Pexp_setfield (e, l, e2) -> string "todo Pexp_setfield" | Pexp_array el -> string "todo Pexp_array" - | Pexp_ifthenelse (e1, e2, e3) -> string "todo Pexp_ifthenelse" + | Pexp_ifthenelse (e1, e2, e3) -> + string "if" ^^ space ^^ lparen ^^ expression e1 ^^ rparen ^^ space + ^^ lbrace ^^ break 1 ^^ expression e2 ^^ break 1 ^^ rbrace ^^ space + ^^ optional (fun e3 -> string "else" ^^ space ^^ expression e3) e3 | Pexp_sequence (e1, e2) -> expression e1 ^^ semi ^^ hardline ^^ expression e2 | Pexp_while (e1, e2) -> string "while" ^^ space ^^ lparen ^^ expression e1 ^^ rparen ^^ space ^^ nest 2 (lbrace ^^ break 1 ^^ expression e2) ^^ break 1 ^^ rbrace | Pexp_for (p, e1, e2, d, e3) -> - string "for" ^^ space ^^ lparen ^^ pattern p ^^ space ^^ string "in" - ^^ space ^^ expression e1 ^^ space ^^ direction_flag d ^^ space - ^^ expression e2 ^^ rparen ^^ space - ^^ nest 2 (lbrace ^^ break 1 ^^ expression e3) + group + (string "for" ^^ space ^^ lparen ^^ pattern p ^^ space ^^ string "in" + ^^ space ^^ expression e1 ^^ space ^^ direction_flag d ^^ space + ^^ expression e2 ^^ rparen ^^ space ^^ lbrace) + ^^ group (nest 2 (break 1 ^^ expression e3)) ^^ break 1 ^^ rbrace | Pexp_constraint (e1, c) -> lparen ^^ expression e1 ^^ colon ^^ space ^^ core_type c ^^ rparen | Pexp_coerce (e, c, c2) -> string "todo Pexp_coerce" - | Pexp_send (e, l) -> string "todo Pexp_send" + | Pexp_send (e, s) -> + let needparens = + match e.pexp_desc with + | Pexp_apply (ee, _) -> ( + match printedStringAndFixityExpr ee with + | UnaryPostfix "^" -> true + | _ -> false) + | _ -> false + in + let lhs = expression e in + let lhs = if needparens then lparen ^^ lhs ^^ rparen else lhs in + lhs ^^ string "#" ^^ string s.txt | Pexp_new l -> string "todo Pexp_new" | Pexp_setinstvar (l, e) -> string "todo Pexp_setinstvar" | Pexp_override l -> string "todo Pexp_override" From df0aa940e77e65c98439e9fe388e8aac2ef75090 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Fri, 5 May 2023 13:24:53 +0200 Subject: [PATCH 10/13] wip --- test/basicStructures.t/run.t.new | 195 +++++++++++++++++++++++-------- 1 file changed, 146 insertions(+), 49 deletions(-) diff --git a/test/basicStructures.t/run.t.new b/test/basicStructures.t/run.t.new index 13c300167..364672f3e 100644 --- a/test/basicStructures.t/run.t.new +++ b/test/basicStructures.t/run.t.new @@ -16,7 +16,7 @@ for (i in 0 to 5) { } }; -for (i in 0 to expr endOfRangeMustBeSimple soWrap) { +for (i in 0 to endOfRangeMustBeSimple(expr,soWrap)) { print_int(i); print_newline(()); for (i in theSame(isTrue, ofThe, startOfRange) downto 0) { @@ -29,21 +29,21 @@ let x = (!)(todo Pexp_field; let x = (!)(todo Pexp_field; -let x = (!)(todo Pexp_send; +let x = (!)(foo#bar; let x = (!)(todo Pexp_field; -let x = (!)(todo Pexp_send; +let x = (!)((!)(foo#bar; let x = not(todo Pexp_field; let x = not(todo Pexp_field; -let x = not(todo Pexp_send; +let x = not(foo#bar; let x = not(todo Pexp_field; -let x = not(todo Pexp_send; +let x = not(not(foo#bar; let x = not(not(todo Pexp_field; @@ -59,11 +59,11 @@ let x = (~!)((~!)(todo Pexp_field; let x = (!!)(todo Pexp_field; -let x = (!!)(todo Pexp_send; +let x = (!!)(foo#bar; let x = (!~)(todo Pexp_field; -let x = (!~)(todo Pexp_send; +let x = (!~)(foo#bar; let noParensNeeded = not(todo Pexp_field; @@ -71,23 +71,35 @@ let parensNeededAroundFirst = todo Pexp_field; let parensNeededAroundSecond = todo Pexp_field; -let noParensNeeded = not(todo Pexp_send; +let noParensNeeded = not(blah#foo#bar; -let parensNeededAroundFirst = todo Pexp_send; +let parensNeededAroundFirst = not(blah#foo#bar; -let parensNeededAroundSecond = todo Pexp_send; +let parensNeededAroundSecond = not(blah#foo#bar; -let parensWithSpaceNeededAroundFirst = todo Pexp_send; +let parensWithSpaceNeededAroundFirst = +not( + not(blah) +)#foo#bar; -let parensWithSpaceNeededAroundSecond = todo Pexp_send; +let parensWithSpaceNeededAroundSecond = +not( + not(blah#foo) +)#bar; -let parensWithSpaceNeededAroundFirst = todo Pexp_send; +let parensWithSpaceNeededAroundFirst = +(?!)( + (~+)(blah) +)#foo#bar; -let parensWithSpaceNeededAroundSecond = todo Pexp_send; +let parensWithSpaceNeededAroundSecond = +(?!)( + (~+)(blah#foo) +)#bar; let x = not(not(todo Pexp_field; -let x = not(not(todo Pexp_send; +let x = not(not(foo#bar; let x = -10; @@ -135,11 +147,20 @@ todo Pstr_attribute let /++ = (+); -let something = todo Pexp_ifthenelse; +let something = if (todo Pexp_field) { +print_string("Did tap"); +print_newline(()) +} ; -let logTapSuccess = self => todo Pexp_ifthenelse; +let logTapSuccess = self => if (todo Pexp_field) { +print_string("Did tap"); +print_newline(()) +} else (); -let logTapSuccess = self => todo Pexp_ifthenelse; +let logTapSuccess = self => if (todo Pexp_field) { +print_string("Did tap"); +print_newline(()) +} ; todo Pexp_setfield; @@ -151,40 +172,112 @@ todo Pexp_setfield; todo Pexp_setfield; -let loop = (appTime, frameTime) => todo Pexp_ifthenelse; -appTime process frameTime; - -todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; +let loop = (appTime, frameTime) => if (todo Pexp_field) { +setupScene(()); +renderIntoTop(()); +todo Pexp_setfield +} ; +process(appTime,frameTime); + +if (something) { +if (somethingElse) { +() +} else "blah" +} ; + +if (something) { +if (somethingElse) { +() +} else "blah" +} ; + +if (true) { +if (true) { +print_string("one") +} else print_string("two") +} ; + +if (true) { +if (false) { +print_string("one") +} else print_string("two") +} ; + +if (false) { +if (true) { +print_string("one") +} else print_string("two") +} ; let printIfFirstArgGreater = true; -let result = todo Pexp_ifthenelse; +let result = if (printIfFirstArgGreater) { +(a, b) => if (a > b) { +print_string("a > b") +} else print_string("b >= a") +} else if ((a, b) => if (a > b) { +print_string("b < a") +} else print_string("a <= b")) { + +print_string( + "That could never possibly type check" +); +print_newline(()) +} ; let myRecord = { nestedRecord: { - anotherNestedRecord: (instaComp, displayRect) => todo Pexp_ifthenelse, + anotherNestedRecord: (instaComp, displayRect) => if ( + Graphics.cgRectIntersectsWithSlop( + defaultCompositeTimerRectSlop, + todo Pexp_field, + displayRect, + )) { + IoEligible + } else IoInelibleButTryComposition, }, }; -todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; - -(a, b) => todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; - -todo Pexp_ifthenelse; +if (printIfFirstArgGreater) { +(a, b) => if (a > b) { +print_string("a > b") +} +} else (a, b) => if (a > b) { +print_string("b < a") +} ; + +if (printIfFirstArgGreater) { +(a, b) => if (a > b) { +print_string("a > b") +} else (a, b) => if (a > b) { +print_string("b < a") +} +} ; + +(a, b) => if (a > b) { print_string("a > b" } ; + +if (printIfFirstArgGreater) { +(a, b) => if (a > b) { +print_string("a > b") +} +} else (a, b) => if (a > b) { +print_string("b < a") +} ; + +if (10 < 100) { + +let msg = "If there was any doubt, 10 is in fact less than 100."; +print_string(msg); +} else +let msg = "All bets are off."; +print_string(msg);; + +if (10 < 100) { + +print_string( + "If there was any doubt, 10 is in fact less than 100." +) +} else print_string("All bets are off."); todo Pstr_attribute @@ -260,7 +353,7 @@ let recsize = ( let recsize = (soFar, lst) => switch (lst) { | [] => 0 -| [hd, ...tl] => soFar + 1 size tl +| [hd, ...tl] => size(soFar + 1,tl) }; let nestedMatch = lstLst => @@ -555,16 +648,20 @@ let identifierLambda = a => (); let underscoreLambda = _ => (); -"should remove parens" it a => { - print_string("did it work?"); - print_string("did it work?") -}; + +it( + "should remove parens", + a => { + print_string("did it work?"); + print_string("did it work?") + }, +); (!)(curNode ## childNodes; foo(preserveBraces => { inCallback}; -preserveBraces => { inFirstPos} foo secondArg; +foo(preserveBraces => { inFirstPos},secondArg); foo( From 757f21995372e5809b1abd811f9a4b2b5aca0eb0 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Fri, 5 May 2023 14:38:27 +0200 Subject: [PATCH 11/13] wip --- src/reason-parser/reason_pprint_ast_pprint.ml | 171 +++++++-- test/basicStructures.t/run.t.new | 348 ++++++++++-------- 2 files changed, 334 insertions(+), 185 deletions(-) diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index 82ed1d0d1..98ddb4c9c 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -1,4 +1,4 @@ -[@@@warning "-27-32-51-37-34"] +[@@@warning "-27-32-51-37-34-26"] open Reason_omp open Ast_411 @@ -895,6 +895,91 @@ let should_preserve_requested_braces expr = preserve_braces && Reason_attributes.has_preserve_braces_attrs stylisticAttrs +let rec extension (s, p) = + match s.txt with + (* We special case "bs.obj" for now to allow for a nicer interop with + * BuckleScript. We might be able to generalize to any kind of record + * looking thing with struct keys. *) + | "bs.obj" -> string "todo: bs.obj" + | _ -> payload "%" s p + +and payload ppxToken ppxId e = + (* let wrap = ("[" ^ ppxToken ^ ppxId.txt, "]") in + let wrap_prefix str (x,y) = (x^str, y) in + let pad = (true, false) in + let postSpace = true in *) + match e with + | PStr [] -> + lbracket ^^ string ppxToken ^^ string ppxId.txt ^^ rbracket + (* string "TODO: payload: PStr[]" *) + | PStr [ itm ] -> + string "TODO: payload: PStr[itm]" + (* makeList ~break:Layout.IfNeed ~wrap ~pad [self#structure_item itm] *) + | PStr (_ :: _ as items) -> + string "TODO: payload: PStr[items]" + (* let rows = List.map self#structure_item items in + makeList ~wrap ~break:Layout.Always ~pad ~postSpace ~sep:(Layout.Sep ";") rows *) + | PTyp x -> string "TODO: payload: PTyp" + (* let wrap = wrap_prefix ":" wrap in + makeList ~wrap ~break:Layout.IfNeed ~pad [self#core_type x] *) + (* Signatures in attributes were added recently *) + | PSig [] -> + string + "TODO: payload: PSig[]" (* atom ("[" ^ ppxToken ^ ppxId.txt ^ ":]") *) + | PSig [ x ] -> + string "TODO: payload: PSign[x]" + (* let wrap = wrap_prefix ":" wrap in + makeList ~break:Layout.IfNeed ~wrap ~pad [self#signature_item x] *) + | PSig items -> + string "TODO: payload: PSig items" + (* let wrap = wrap_prefix ":" wrap in + let rows = List.map self#signature_item items in + makeList ~wrap ~break:Layout.IfNeed ~pad ~postSpace ~sep:(Layout.Sep ";") rows *) + | PPat (x, None) -> + string "TODO: payload: Ppat 1" + (* let wrap = wrap_prefix "?" wrap in + makeList ~wrap ~break:Layout.IfNeed ~pad [self#pattern_at_least_as_simple_as_alias_or_or x] *) + | PPat (x, Some e) -> string "TODO: payload: Ppat 2" +(* let wrap = wrap_prefix "?" wrap in + makeList ~wrap ~break:Layout.IfNeed ~pad ~postSpace [ + self#pattern_at_least_as_simple_as_alias_or_or x; + label ~space:true (atom "when") (self#unparseExpr e) + ] *) + +(* [@ ...] Simple attributes *) +let attribute = function + | { + attr_name = { Location.txt = "ocaml.doc" | "ocaml.text" }; + attr_payload = + PStr + [ + { + pstr_desc = + Pstr_eval + ( { pexp_desc = Pexp_constant (Pconst_string (text, _, None)) }, + _ ); + pstr_loc; + }; + ]; + _; + } -> + let text = + if text = "" then string "/**/" + else string "/**" ^^ string text ^^ string "*/" + in + text + (* makeList ~inline:(true, true) ~postSpace:true ~preSpace:true ~indent:0 ~break:IfNeed [atom ~loc:pstr_loc text] *) + | { attr_name; attr_payload; _ } -> payload "@" attr_name attr_payload + +(* [@@ ... ] Attributes that occur after a major item in a structure/class *) +let item_attribute = attribute +let floating_attribute = item_attribute + +(* [@@ ...] Attributes that occur not *after* an item in some structure/class/sig, but + rather as their own standalone item. Note that syntactic distinction + between item_attribute and floating_attribute is no longer necessary with + Reason. Thank you semicolons. *) + let rec structure_item term = match term.pstr_desc with | Pstr_eval (e, attrs) -> @@ -924,7 +1009,7 @@ let rec structure_item term = | Pstr_class cl -> string "todo Pstr_class" | Pstr_class_type cl -> string "todo Pstr_class_type" | Pstr_include i -> string "todo Pstr_include" - | Pstr_attribute a -> string "todo Pstr_attribute" + | Pstr_attribute a -> floating_attribute a | Pstr_extension (e, a) -> string "todo Pstr_extension" and module_expr = function @@ -1085,19 +1170,35 @@ and expression ?(depth = 0) ?(wrap = true) x = expression a ^^ space ^^ expression infixOperator ^^ space ^^ expression b) | Pexp_apply (e, l) -> - ifflat - (expression e ^^ lparen - ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l) - (group - (break 0 ^^ expression e ^^ lparen - ^^ nest 2 - (break 0 - ^^ separate_map - (comma ^^ break 1) - (fun (_, e) -> expression ~wrap:false e) - l - ^^ ifflat empty (if List.length l = 1 then empty else comma)) - ^^ break 0 ^^ rparen)) + (* ifflat + (expression e ^^ lparen + ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l) + (group + (break 0 ^^ expression e ^^ lparen + ^^ nest 2 + (break 0 + ^^ separate_map + (comma ^^ break 1) + (fun (_, e) -> expression ~wrap:false e) + l + ^^ ifflat empty (if List.length l = 1 then empty else comma)) + ^^ break 0 ^^ rparen)) *) + group + (ifflat + (expression e ^^ lparen + ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l + ^^ rparen) + (group + (break 0 ^^ expression e ^^ lparen + ^^ nest 2 + (break 0 + ^^ separate_map + (comma ^^ break 1) + (fun (_, e) -> expression ~wrap:false e) + l + ^^ ifflat empty (if List.length l = 1 then empty else comma) + ) + ^^ break 0 ^^ rparen))) | Pexp_match (e, cl) -> group (nest depth @@ -1132,23 +1233,33 @@ and expression ?(depth = 0) ?(wrap = true) x = ^^ separate_map (comma ^^ break 1) (fun (l, e) -> - match l.txt with - | Lident name -> ( - match e with - | { pexp_desc = Pexp_ident { txt = Lident value }; _ } - when name = value -> - string name - | _ -> string name ^^ colon ^^ space ^^ expression e) - | _ -> string "Ppat_record: not supported") + let name = longident l.txt in + match e with + | { pexp_desc = Pexp_ident l; _ } when name = longident l.txt + -> + name + | _ -> name ^^ colon ^^ space ^^ expression e) l) ^^ ifflat empty comma ^^ break 0 ^^ rbrace) - | Pexp_field (e, l) -> string "todo Pexp_field" + | Pexp_field (e, li) -> + let _prec = Token "." in + let leftItm = expression e in + let { stdAttrs } = partitionAttributes e.pexp_attributes in + let formattedLeftItm = if stdAttrs == [] then leftItm else leftItm in + let layout = group (formattedLeftItm ^^ dot ^^ longident li.txt) in + layout + (* SpecificInfixPrecedence + ({ reducePrecedence = prec; shiftPrecedence = prec }, LayoutNode layout) *) | Pexp_setfield (e, l, e2) -> string "todo Pexp_setfield" | Pexp_array el -> string "todo Pexp_array" | Pexp_ifthenelse (e1, e2, e3) -> string "if" ^^ space ^^ lparen ^^ expression e1 ^^ rparen ^^ space - ^^ lbrace ^^ break 1 ^^ expression e2 ^^ break 1 ^^ rbrace ^^ space - ^^ optional (fun e3 -> string "else" ^^ space ^^ expression e3) e3 + ^^ lbrace + ^^ nest 2 (break 1 ^^ expression e2 ^^ break 1) + ^^ rbrace + ^^ optional + (fun e3 -> break 1 ^^ string "else" ^^ space ^^ expression e3) + e3 | Pexp_sequence (e1, e2) -> expression e1 ^^ semi ^^ hardline ^^ expression e2 | Pexp_while (e1, e2) -> string "while" ^^ space ^^ lparen ^^ expression e1 ^^ rparen ^^ space @@ -1247,7 +1358,7 @@ and pattern ?(wrap = true) | Ppat_construct ({ txt = Lident s }, c) -> string s ^^ optional (fun f -> pattern (snd f)) c | Ppat_construct (s, s2) -> string "todo Ppatconstruct" - | Ppat_variant (l, po) -> string "todo: Ppat_variant" + | Ppat_variant (l, po) -> string "`" ^^ string l | Ppat_record (pl, c) -> group (nest 2 @@ -1273,11 +1384,11 @@ and pattern ?(wrap = true) | Ppat_or (p, p2) -> pattern p ^^ hardline ^^ bar ^^ space ^^ pattern p2 | Ppat_constraint (p, c) -> lparen ^^ pattern p ^^ colon ^^ space ^^ core_type c ^^ rparen - | Ppat_type l -> string "todo: Ppat_type" - | Ppat_lazy p -> string "todo: Ppat_lazy" + | Ppat_type l -> string "#" ^^ longident l.txt + | Ppat_lazy p -> string "lazy" ^^ space ^^ pattern p | Ppat_unpack l -> string "todo: Ppat_unpack" | Ppat_exception p -> string "todo: Ppat_exception" - | Ppat_extension e -> string "todo: Ppat_extension" + | Ppat_extension e -> extension e | Ppat_open (l, p) -> string "todo: Ppat_open" and type_declaration diff --git a/test/basicStructures.t/run.t.new b/test/basicStructures.t/run.t.new index 364672f3e..67d8ec39e 100644 --- a/test/basicStructures.t/run.t.new +++ b/test/basicStructures.t/run.t.new @@ -19,63 +19,63 @@ for (i in 0 to 5) { for (i in 0 to endOfRangeMustBeSimple(expr,soWrap)) { print_int(i); print_newline(()); - for (i in theSame(isTrue, ofThe, startOfRange) downto 0) { + for (i in theSame(isTrue,ofThe,startOfRange) downto 0) { print_string("Counting in reverse direction"); print_newline(()) } }; -let x = (!)(todo Pexp_field; +let x = (!)((!)((!)(foo)).bar); -let x = (!)(todo Pexp_field; +let x = (!)(foo.bar); -let x = (!)(foo#bar; +let x = (!)(foo#bar); -let x = (!)(todo Pexp_field; +let x = (!)((!)(foo).bar); -let x = (!)((!)(foo#bar; +let x = (!)((!)(foo)#bar); -let x = not(todo Pexp_field; +let x = not(not(not(foo)).bar); -let x = not(todo Pexp_field; +let x = not(foo.bar); -let x = not(foo#bar; +let x = not(foo#bar); -let x = not(todo Pexp_field; +let x = not(not(foo).bar); -let x = not(not(foo#bar; +let x = not(not(foo)#bar); -let x = not(not(todo Pexp_field; +let x = not(not(foo.bar)); -let x = (?!)(not(todo Pexp_field; +let x = (?!)(not(foo.bar)); -let x = not((?!)(todo Pexp_field; +let x = not((?!)(foo.bar)); -let x = (~!)(not(todo Pexp_field; +let x = (~!)(not(foo.bar)); -let x = not((~!)(todo Pexp_field; +let x = not((~!)(foo.bar)); -let x = (~!)((~!)(todo Pexp_field; +let x = (~!)((~!)(foo.bar)); -let x = (!!)(todo Pexp_field; +let x = (!!)(foo.bar); -let x = (!!)(foo#bar; +let x = (!!)(foo#bar); -let x = (!~)(todo Pexp_field; +let x = (!~)(foo.bar); -let x = (!~)(foo#bar; +let x = (!~)(foo#bar); -let noParensNeeded = not(todo Pexp_field; +let noParensNeeded = not(blah.foo.bar); -let parensNeededAroundFirst = todo Pexp_field; +let parensNeededAroundFirst = not(blah).foo.bar; -let parensNeededAroundSecond = todo Pexp_field; +let parensNeededAroundSecond = not(blah.foo).bar; -let noParensNeeded = not(blah#foo#bar; +let noParensNeeded = not(blah#foo#bar); -let parensNeededAroundFirst = not(blah#foo#bar; +let parensNeededAroundFirst = not(blah)#foo#bar; -let parensNeededAroundSecond = not(blah#foo#bar; +let parensNeededAroundSecond = not(blah#foo)#bar; let parensWithSpaceNeededAroundFirst = not( @@ -97,9 +97,9 @@ let parensWithSpaceNeededAroundSecond = (~+)(blah#foo) )#bar; -let x = not(not(todo Pexp_field; +let x = not(not(foo.bar)); -let x = not(not(foo#bar; +let x = not(not(foo#bar)); let x = -10; @@ -109,58 +109,61 @@ let x = Some(-10); let x = Some(-5.); -let todo: Ppat_lazy = 10; +let lazy x = 10; -let todo: Ppat_lazy = 10; +let lazy (x: int) = 10; -let todo: Ppat_lazy = 10; +let lazy [] = 10; -let todo: Ppat_lazy = 10; +let lazy true = 10; -let todo: Ppat_lazy = 10; +let lazy #x = 10; -let todo: Ppat_lazy = 10; +let lazy `Variant = 10; -let todo: Ppat_lazy = 10; +let lazy `variant = 10; -let todo: Ppat_lazy = 10; +let lazy '0' .. '9' = 10; -let todo: Ppat_lazy = 10; +let lazy lazy true = 10; -let todo: Ppat_lazy = 10; +let lazy [%extend] = 10; -let x = Array.get((!)(arr,0; +let x = Array.get((!)(arr),0); -let x = Array.get((!)(arr,0; +let x = Array.get((!)(arr),0); -let x = String.get((!)(str,0; +let x = String.get((!)(str),0); -let x = String.get((!)(str,0; +let x = String.get((!)(str),0); -let x = Array.set((!)(arr,0,1; +let x = Array.set((!)(arr),0,1); -let x = Array.set((!)(arr,0,1; +let x = Array.set((!)(arr),0,1); -todo Pstr_attribute +/**/ -todo Pstr_attribute +/** IF + *============================================================================ + */ let /++ = (+); -let something = if (todo Pexp_field) { -print_string("Did tap"); -print_newline(()) -} ; +let something = if (self.ext.logSuccess) { + print_string("Did tap"); + print_newline(()) + }; -let logTapSuccess = self => if (todo Pexp_field) { -print_string("Did tap"); -print_newline(()) -} else (); +let logTapSuccess = self => if (self.ext.logSuccess) { + print_string("Did tap"); + print_newline(()) + } +else (); -let logTapSuccess = self => if (todo Pexp_field) { -print_string("Did tap"); -print_newline(()) -} ; +let logTapSuccess = self => if (self.ext.logSuccess) { + print_string("Did tap"); + print_newline(()) + }; todo Pexp_setfield; @@ -172,114 +175,130 @@ todo Pexp_setfield; todo Pexp_setfield; -let loop = (appTime, frameTime) => if (todo Pexp_field) { -setupScene(()); -renderIntoTop(()); -todo Pexp_setfield -} ; +let loop = (appTime, frameTime) => if (hasSetup.contents) { + setupScene(()); + renderIntoTop(()); + todo Pexp_setfield + }; process(appTime,frameTime); if (something) { -if (somethingElse) { -() -} else "blah" -} ; + if (somethingElse) { + () + } + else "blah" + }; if (something) { -if (somethingElse) { -() -} else "blah" -} ; + if (somethingElse) { + () + } + else "blah" + }; if (true) { -if (true) { -print_string("one") -} else print_string("two") -} ; + if (true) { + print_string("one") + } + else print_string("two") + }; if (true) { -if (false) { -print_string("one") -} else print_string("two") -} ; + if (false) { + print_string("one") + } + else print_string("two") + }; if (false) { -if (true) { -print_string("one") -} else print_string("two") -} ; + if (true) { + print_string("one") + } + else print_string("two") + }; let printIfFirstArgGreater = true; let result = if (printIfFirstArgGreater) { -(a, b) => if (a > b) { -print_string("a > b") -} else print_string("b >= a") -} else if ((a, b) => if (a > b) { -print_string("b < a") -} else print_string("a <= b")) { - -print_string( - "That could never possibly type check" -); -print_newline(()) -} ; + (a, b) => if (a > b) { + print_string("a > b") + } + else print_string("b >= a") + } +else if ((a, b) => if (a > b) { + print_string("b < a") + } +else print_string("a <= b")) { + + print_string( + "That could never possibly type check" + ); + print_newline(()) + }; let myRecord = { nestedRecord: { anotherNestedRecord: (instaComp, displayRect) => if ( Graphics.cgRectIntersectsWithSlop( defaultCompositeTimerRectSlop, - todo Pexp_field, + instaComp.relativeRect, displayRect, )) { - IoEligible - } else IoInelibleButTryComposition, + IoEligible + } + else IoInelibleButTryComposition, }, }; if (printIfFirstArgGreater) { -(a, b) => if (a > b) { -print_string("a > b") -} -} else (a, b) => if (a > b) { -print_string("b < a") -} ; + (a, b) => if (a > b) { + print_string("a > b") + } + } +else (a, b) => if (a > b) { + print_string("b < a") + }; if (printIfFirstArgGreater) { -(a, b) => if (a > b) { -print_string("a > b") -} else (a, b) => if (a > b) { -print_string("b < a") -} -} ; + (a, b) => if (a > b) { + print_string("a > b") + } + else (a, b) => if (a > b) { + print_string("b < a") + } + }; -(a, b) => if (a > b) { print_string("a > b" } ; +(a, b) => if (a > b) { print_string("a > b") }; if (printIfFirstArgGreater) { -(a, b) => if (a > b) { -print_string("a > b") -} -} else (a, b) => if (a > b) { -print_string("b < a") -} ; + (a, b) => if (a > b) { + print_string("a > b") + } + } +else (a, b) => if (a > b) { + print_string("b < a") + }; if (10 < 100) { -let msg = "If there was any doubt, 10 is in fact less than 100."; -print_string(msg); -} else + let msg = "If there was any doubt, 10 is in fact less than 100."; + print_string(msg); + } +else let msg = "All bets are off."; print_string(msg);; if (10 < 100) { -print_string( - "If there was any doubt, 10 is in fact less than 100." -) -} else print_string("All bets are off."); + print_string( + "If there was any doubt, 10 is in fact less than 100." + ) + } +else print_string("All bets are off."); -todo Pstr_attribute +/** TYPE CONSTRAINTS + *============================================================================ + */ let x = (10: int); @@ -289,7 +308,9 @@ let (x: int) = 10; let (x: int) = (10: int); -todo Pstr_attribute +/** TUPLES + *============================================================================ + */ type pairOfInts = other type...; @@ -332,7 +353,9 @@ let trailingCommaAccepted = (1, 2); let moreTrailing = (1, 2, 3, 4, 5, 7); -todo Pstr_attribute +/** Immutable Lists + * ============================================================================ + */ let x = (Pexp_construct list: list(int)); @@ -347,7 +370,7 @@ let result = (Pexp_construct list: list(string)); let recsize = ( fun | [] => 0 - | [hd, ...tl] => 1 + size(tl + | [hd, ...tl] => 1 + size(tl) ); let recsize = (soFar, lst) => @@ -379,7 +402,9 @@ switch (lstLst) { | [] => 0 }; -todo Pstr_attribute +/** + * Aliasing with "as" during matches. + */ type mine = | MyThing(int) @@ -403,7 +428,12 @@ let ppp = let todo: Ppat_alias | todo: Ppat_alias = ppp; -todo Pstr_attribute +/** ARRAYS + * ============================================================================ + * Arrays are weird looking. Usually you want lists because they support pattern + * matching - that's why they have nicer syntax - to entice you. But if you want + * random access and better control over memory layout, use arrays. + */ let emptyArray = todo Pexp_array; @@ -411,17 +441,21 @@ let arrayWithOne = todo Pexp_array; let arrayWithTwo = todo Pexp_array; -let secondItem = Array.get(arrayWithTwo,1; +let secondItem = Array.get(arrayWithTwo,1); -let secondItem = Array.get(arrayWithTwo,1; +let secondItem = Array.get(arrayWithTwo,1); -Array.set(arrayWithTwo,1,300; +Array.set(arrayWithTwo,1,300); -todo Pstr_attribute +/** + * STRINGS + * ============================================================================ + * The language supports mutating strings, but that should not be depended upon. + */ let myString = "asdf"; -String.set(myString,2,'9'; +String.set(myString,2,'9'); let one = 900; @@ -465,7 +499,11 @@ let curriedFormThree = ((i: int), (( b, ): other type...); -todo Pstr_attribute +/** TODO: But this, however doesn't work. + * let (myCurriedFunc: int => int) a => a; + * Note: This is likely because only "simple patterns" are accepted as constraints + * in let bindings - that may be easy to change. + */ type myFuncType = other type...; @@ -486,7 +524,10 @@ type c = type d = other type...; -todo Pstr_attribute +/** + * Records: + *============================================================================= + */ type withThreeFields = { name: string, @@ -502,7 +543,7 @@ let testRecord = { let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; let makeRecordBase = () => { @@ -513,37 +554,37 @@ let makeRecordBase = () => { let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; let anotherRecord = { name: "joe++", - age: todo Pexp_field + 10, + age: testRecord.age + 10, }; type props = { @@ -600,16 +641,13 @@ let componentA = {props}; let componentB = {props, state: ()}; -let foo = {Ppat_record: not supported}; +let foo = {Foo.foo: foo}; -let bar = {Ppat_record: not supported, bar: 1}; +let bar = {Foo.foo: foo, bar: 1}; -let bar = {bar: 1, Ppat_record: not supported}; +let bar = {bar: 1, Foo.foo: foo}; -let bar = { - Ppat_record: not supported, - Ppat_record: not supported, -}; +let bar = {Foo.foo: foo, Bar.bar: bar}; {Ppat_record: not supported, y} => 1; @@ -657,9 +695,9 @@ it( }, ); -(!)(curNode ## childNodes; +(!)(curNode) ## childNodes; -foo(preserveBraces => { inCallback}; +foo(preserveBraces => { inCallback}); foo(preserveBraces => { inFirstPos},secondArg); From 76f603b68befeeb478d023aee1a62c44ea747d3f Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Fri, 5 May 2023 20:07:19 +0200 Subject: [PATCH 12/13] wip --- src/reason-parser/reason_pprint_ast_pprint.ml | 89 +++++--- test/basicStructures.t/run.t.new | 200 +++++++++--------- 2 files changed, 160 insertions(+), 129 deletions(-) diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index 98ddb4c9c..e7110b10f 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -900,7 +900,7 @@ let rec extension (s, p) = (* We special case "bs.obj" for now to allow for a nicer interop with * BuckleScript. We might be able to generalize to any kind of record * looking thing with struct keys. *) - | "bs.obj" -> string "todo: bs.obj" + | "bs.obj" -> string "todo: extension bs.obj" | _ -> payload "%" s p and payload ppxToken ppxId e = @@ -1026,7 +1026,9 @@ and value_bindings rf vb = concat_map attribute fstAttrs.docAttrs ^^ concat_map attribute fstAttrs.stdAttrs ^^ string "let" ^^ space - ^^ (match rf with Nonrecursive -> empty | Recursive -> string "rec") + ^^ (match rf with + | Nonrecursive -> empty + | Recursive -> string "rec" ^^ space) ^^ separate_map (space ^^ hardline ^^ string "and" ^^ space) value_binding vb and attribute = function @@ -1109,6 +1111,7 @@ and direction_flag (f : Compiler_libs.Asttypes.direction_flag) = and expression ?(depth = 0) ?(wrap = true) x = let { pexp_desc; pexp_loc; pexp_loc_stack; pexp_attributes } = x in match pexp_desc with + | Pexp_ident { txt = Lident "not" } -> bang | Pexp_ident { txt } -> longident txt | Pexp_constant c -> constant c | Pexp_let (rf, vb, e) -> @@ -1153,7 +1156,7 @@ and expression ?(depth = 0) ?(wrap = true) x = group (ifflat (expression infixOperator ^^ lparen - ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l + ^^ separate_map (comma ^^ space) (fun (_, e) -> expression e) l ^^ rparen) (group (break 0 ^^ expression infixOperator ^^ lparen @@ -1170,26 +1173,22 @@ and expression ?(depth = 0) ?(wrap = true) x = expression a ^^ space ^^ expression infixOperator ^^ space ^^ expression b) | Pexp_apply (e, l) -> - (* ifflat - (expression e ^^ lparen - ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l) - (group - (break 0 ^^ expression e ^^ lparen - ^^ nest 2 - (break 0 - ^^ separate_map - (comma ^^ break 1) - (fun (_, e) -> expression ~wrap:false e) - l - ^^ ifflat empty (if List.length l = 1 then empty else comma)) - ^^ break 0 ^^ rparen)) *) + let leftParen, rightParen = + match l with + | (_, { pexp_desc = Pexp_construct ({ txt = Lident "()"; _ }, _); _ }) + :: [] -> + (empty, empty) + | _ -> (lparen, rparen) + in group (ifflat - (expression e ^^ lparen - ^^ separate_map comma (fun (_, e) -> expression ~wrap:false e) l - ^^ rparen) + (expression e ^^ leftParen + ^^ separate_map (comma ^^ space) + (fun (_, e) -> expression ~wrap:false e) + l + ^^ rightParen) (group - (break 0 ^^ expression e ^^ lparen + (break 0 ^^ expression e ^^ leftParen ^^ nest 2 (break 0 ^^ separate_map @@ -1198,7 +1197,7 @@ and expression ?(depth = 0) ?(wrap = true) x = l ^^ ifflat empty (if List.length l = 1 then empty else comma) ) - ^^ break 0 ^^ rparen))) + ^^ break 0 ^^ rightParen))) | Pexp_match (e, cl) -> group (nest depth @@ -1218,8 +1217,12 @@ and expression ?(depth = 0) ?(wrap = true) x = match view_expr x with | `nil -> string "[]" | `tuple -> string "()" - | `list xs -> string "Pexp_construct list" - | `cons xs -> string "Pexp_construct cons" + | `list xs -> + lbracket ^^ separate_map (comma ^^ break 1) expression xs ^^ rbracket + | `cons (hd :: tl) -> + lbracket ^^ expression hd ^^ comma ^^ space ^^ dot ^^ dot ^^ dot + ^^ separate_map (comma ^^ break 1) expression tl + ^^ rbracket | `simple x -> longident x | _ -> assert false) | Pexp_construct ({ txt = Lident s1 }, opt) -> @@ -1250,8 +1253,11 @@ and expression ?(depth = 0) ?(wrap = true) x = layout (* SpecificInfixPrecedence ({ reducePrecedence = prec; shiftPrecedence = prec }, LayoutNode layout) *) - | Pexp_setfield (e, l, e2) -> string "todo Pexp_setfield" - | Pexp_array el -> string "todo Pexp_array" + | Pexp_setfield (e, l, e2) -> expression e ^^ dot ^^ expression e2 + | Pexp_array el -> + lbracket ^^ bar + ^^ separate_map (comma ^^ space) expression el + ^^ bar ^^ rbracket | Pexp_ifthenelse (e1, e2, e3) -> string "if" ^^ space ^^ lparen ^^ expression e1 ^^ rparen ^^ space ^^ lbrace @@ -1296,7 +1302,8 @@ and expression ?(depth = 0) ?(wrap = true) x = | Pexp_lazy e -> string "todo Pexp_lazy" | Pexp_poly (e, ct) -> string "todo Pexp_poly" | Pexp_object c -> string "todo Pexp_object" - | Pexp_newtype (s, e) -> string "todo Pexp_newtype" + | Pexp_newtype (s, e) -> + lparen ^^ string "type" ^^ space ^^ string s.txt ^^ expression e ^^ rparen | Pexp_pack m -> string "todo Pexp_pack" | Pexp_open (o, e) -> string "todo Pexp_open" | Pexp_letop l -> string "todo Pexp_letop" @@ -1318,7 +1325,8 @@ and pattern ?(wrap = true) match ppat_desc with | Ppat_var v -> string v.txt | Ppat_any -> underscore - | Ppat_alias (p, l) -> string "todo: Ppat_alias" + | Ppat_alias (p, l) -> + pattern p ^^ space ^^ string "as" ^^ space ^^ string l.txt | Ppat_constant c -> constant c | Ppat_interval (c, c2) -> constant c ^^ space ^^ string ".." ^^ space ^^ constant c2 @@ -1373,7 +1381,9 @@ and pattern ?(wrap = true) when name = value -> string name | _ -> string name ^^ colon ^^ space ^^ pattern p) - | _ -> string "Ppat_record: not supported") + | _ -> + let name = longident l.txt in + name ^^ colon ^^ space ^^ pattern p) pl) ^^ ifflat empty comma ^^ break 0 ^^ rbrace) | Ppat_array pl -> @@ -1434,11 +1444,24 @@ and label_declaration { pld_name; pld_type; _ } = and core_type { ptyp_desc; _ } = match ptyp_desc with - | Ptyp_var _ -> string "todo a" - | Ptyp_constr ({ txt = Lident s1 }, []) -> string s1 - | Ptyp_constr ({ txt = Lident s1 }, cl) -> - string s1 ^^ lparen ^^ separate_map star core_type cl ^^ rparen - | _ -> string "other type..." + | Ptyp_var v -> squote ^^ string v + | Ptyp_constr ({ txt }, cl) -> ( + longident txt + ^^ + match cl with + | [] -> empty + | _ -> lparen ^^ separate_map star core_type cl ^^ rparen) + | Ptyp_arrow (l, a, b) -> core_type a ^^ arrow ^^ core_type b + | Ptyp_tuple lst1 -> + lparen ^^ separate_map (comma ^^ space) core_type lst1 ^^ rparen + | Ptyp_variant _ -> string "todo Ptyp_variant" + | Ptyp_extension _ -> string "todo Ptyp_extension" + | Ptyp_any -> string "todo Ptyp_any" + | Ptyp_object (_, _) -> string "todo Ptyp_object" + | Ptyp_class (_, _) -> string "todo Ptyp_class" + | Ptyp_alias (_, _) -> string "todo Ptyp_alias" + | Ptyp_poly (_, _) -> string "todo Ptyp_poly" + | Ptyp_package _ -> string "todo Ptyp_package" and structure structureItems = group (separate_map (hardline ^^ hardline) structure_item structureItems) diff --git a/test/basicStructures.t/run.t.new b/test/basicStructures.t/run.t.new index 67d8ec39e..bca02a1dc 100644 --- a/test/basicStructures.t/run.t.new +++ b/test/basicStructures.t/run.t.new @@ -4,24 +4,28 @@ let run = () => { while (something) { print_string("You're in a while loop"); - print_newline(()) + print_newline() }; for (i in 0 to 5) { print_int(i); - print_newline(()); + print_newline(); for (i in 10 downto 0) { print_string("Counting in reverse direction"); - print_newline(()) + print_newline() } }; -for (i in 0 to endOfRangeMustBeSimple(expr,soWrap)) { +for (i in 0 to +endOfRangeMustBeSimple( + expr, + soWrap, +)) { print_int(i); - print_newline(()); - for (i in theSame(isTrue,ofThe,startOfRange) downto 0) { + print_newline(); + for (i in theSame(isTrue, ofThe, startOfRange) downto 0) { print_string("Counting in reverse direction"); - print_newline(()) + print_newline() } }; @@ -35,25 +39,25 @@ let x = (!)((!)(foo).bar); let x = (!)((!)(foo)#bar); -let x = not(not(not(foo)).bar); +let x = !(!(!(foo)).bar); -let x = not(foo.bar); +let x = !(foo.bar); -let x = not(foo#bar); +let x = !(foo#bar); -let x = not(not(foo).bar); +let x = !(!(foo).bar); -let x = not(not(foo)#bar); +let x = !(!(foo)#bar); -let x = not(not(foo.bar)); +let x = !(!(foo.bar)); -let x = (?!)(not(foo.bar)); +let x = (?!)(!(foo.bar)); -let x = not((?!)(foo.bar)); +let x = !((?!)(foo.bar)); -let x = (~!)(not(foo.bar)); +let x = (~!)(!(foo.bar)); -let x = not((~!)(foo.bar)); +let x = !((~!)(foo.bar)); let x = (~!)((~!)(foo.bar)); @@ -65,26 +69,23 @@ let x = (!~)(foo.bar); let x = (!~)(foo#bar); -let noParensNeeded = not(blah.foo.bar); +let noParensNeeded = !(blah.foo.bar); -let parensNeededAroundFirst = not(blah).foo.bar; +let parensNeededAroundFirst = !(blah).foo.bar; -let parensNeededAroundSecond = not(blah.foo).bar; +let parensNeededAroundSecond = !(blah.foo).bar; -let noParensNeeded = not(blah#foo#bar); +let noParensNeeded = !(blah#foo#bar); -let parensNeededAroundFirst = not(blah)#foo#bar; +let parensNeededAroundFirst = !(blah)#foo#bar; -let parensNeededAroundSecond = not(blah#foo)#bar; +let parensNeededAroundSecond = !(blah#foo)#bar; -let parensWithSpaceNeededAroundFirst = -not( - not(blah) -)#foo#bar; +let parensWithSpaceNeededAroundFirst = !(!(blah))#foo#bar; let parensWithSpaceNeededAroundSecond = -not( - not(blah#foo) +!( + !(blah#foo) )#bar; let parensWithSpaceNeededAroundFirst = @@ -97,9 +98,9 @@ let parensWithSpaceNeededAroundSecond = (~+)(blah#foo) )#bar; -let x = not(not(foo.bar)); +let x = !(!(foo.bar)); -let x = not(not(foo#bar)); +let x = !(!(foo#bar)); let x = -10; @@ -129,17 +130,17 @@ let lazy lazy true = 10; let lazy [%extend] = 10; -let x = Array.get((!)(arr),0); +let x = Array.get((!)(arr), 0); -let x = Array.get((!)(arr),0); +let x = Array.get((!)(arr), 0); -let x = String.get((!)(str),0); +let x = String.get((!)(str), 0); -let x = String.get((!)(str),0); +let x = String.get((!)(str), 0); -let x = Array.set((!)(arr),0,1); +let x = Array.set((!)(arr), 0, 1); -let x = Array.set((!)(arr),0,1); +let x = Array.set((!)(arr), 0, 1); /**/ @@ -151,36 +152,36 @@ let /++ = (+); let something = if (self.ext.logSuccess) { print_string("Did tap"); - print_newline(()) + print_newline() }; let logTapSuccess = self => if (self.ext.logSuccess) { print_string("Did tap"); - print_newline(()) + print_newline() } else (); let logTapSuccess = self => if (self.ext.logSuccess) { print_string("Did tap"); - print_newline(()) + print_newline() }; -todo Pexp_setfield; +!(data).true; -todo Pexp_setfield; +!(data).field1.true; -todo Pexp_setfield; +!(data.field1).true; -todo Pexp_setfield; +!(data).field1.true; -todo Pexp_setfield; +!(data.field1).true; let loop = (appTime, frameTime) => if (hasSetup.contents) { - setupScene(()); - renderIntoTop(()); - todo Pexp_setfield + setupScene(); + renderIntoTop(); + hasSetup.true }; -process(appTime,frameTime); +process(appTime, frameTime); if (something) { if (somethingElse) { @@ -233,7 +234,7 @@ else print_string("a <= b")) { print_string( "That could never possibly type check" ); - print_newline(()) + print_newline() }; let myRecord = { @@ -312,7 +313,7 @@ let (x: int) = (10: int); *============================================================================ */ -type pairOfInts = other type...; +type pairOfInts = (int, int); let (letBindingWithTypeConstraint: int) = 10; @@ -344,7 +345,7 @@ let ( (constrainedWithoutGrouping: int), ) = (10, 20); -let ((tupleItem, withOutsideTypeConstraint): other type...) = ( +let ((tupleItem, withOutsideTypeConstraint): (int, int)) = ( 10, 20, ); @@ -357,26 +358,29 @@ let moreTrailing = (1, 2, 3, 4, 5, 7); * ============================================================================ */ -let x = (Pexp_construct list: list(int)); +let x = ([1, 2, 3, 4, 5, 6, 7, 8, 9]: list(int)); let hd = "appendedToHead"; -let tl = Pexp_construct list; +let tl = ["listTo", "append", "to"]; -let result = (Pexp_construct cons: list(string)); +let result = ([hd, ...tl]: list(string)); -let result = (Pexp_construct list: list(string)); +let result = (["appendedToHead", +"listTo", +"append", +"to"]: list(string)); -let recsize = ( +let rec size = ( fun | [] => 0 | [hd, ...tl] => 1 + size(tl) ); -let recsize = (soFar, lst) => +let rec size = (soFar, lst) => switch (lst) { | [] => 0 -| [hd, ...tl] => size(soFar + 1,tl) +| [hd, ...tl] => size(soFar + 1, tl) }; let nestedMatch = lstLst => @@ -412,21 +416,21 @@ type mine = let ppp = switch (MyThing(20)) { - | todo: Ppat_alias - | todo: Ppat_alias => ppp + | MyThing(x) as ppp + | YourThing(x) as ppp => ppp }; -let todo: Ppat_alias -| todo: Ppat_alias = ppp; +let MyThing_ as ppp +| YourThing_ as ppp = ppp; let ppp = switch (MyThing(20)) { - | todo: Ppat_alias - | todo: Ppat_alias => ppp + | MyThing(x) as ppp + | YourThing(x) as ppp => ppp }; -let todo: Ppat_alias -| todo: Ppat_alias = ppp; +let MyThing_ as ppp +| YourThing_ as ppp = ppp; /** ARRAYS * ============================================================================ @@ -435,17 +439,17 @@ let todo: Ppat_alias * random access and better control over memory layout, use arrays. */ -let emptyArray = todo Pexp_array; +let emptyArray = [||]; -let arrayWithOne = todo Pexp_array; +let arrayWithOne = [|10|]; -let arrayWithTwo = todo Pexp_array; +let arrayWithTwo = [|10, 10|]; -let secondItem = Array.get(arrayWithTwo,1); +let secondItem = Array.get(arrayWithTwo, 1); -let secondItem = Array.get(arrayWithTwo,1); +let secondItem = Array.get(arrayWithTwo, 1); -Array.set(arrayWithTwo,1,300); +Array.set(arrayWithTwo, 1, 300); /** * STRINGS @@ -455,7 +459,7 @@ Array.set(arrayWithTwo,1,300); let myString = "asdf"; -String.set(myString,2,'9'); +String.set(myString, 2, '9'); let one = 900; @@ -463,7 +467,7 @@ let two = 10000; let myTuple = ((one: int), (two: int)); -type myTupleType = other type...; +type myTupleType = (int, int); let myTuple = (myTuple: myTupleType); @@ -478,7 +482,7 @@ let addValues = ((a: int), (b: int)) => a + b; let myFunction = ((a: int), (b: int)) => (a + b: int); -let functionReturnValueType = ((i: int), (s: string)) => (x => x + 1: other type...); +let functionReturnValueType = ((i: int), (s: string)) => (x => x + 1: int => int); let curriedFormOne = ((i: int), (s: string)) => s (^) string_of_int( @@ -488,16 +492,16 @@ string_of_int( let curriedFormTwo = ((i: int), (x: int)) => (( i, x, -): other type...); +): (int, int)); let curriedFormThree = ((i: int), (( (a: int), (b: int), -): other type...)) => (( +): (int, int))) => (( i, a, b, -): other type...); +): (int, int, int)); /** TODO: But this, however doesn't work. * let (myCurriedFunc: int => int) a => a; @@ -505,24 +509,28 @@ let curriedFormThree = ((i: int), (( * in let bindings - that may be easy to change. */ -type myFuncType = other type...; +type myFuncType = int => int => int; let myFunc = ((a, b) => a + b: myFuncType); -let funcWithTypeLocallyAbstractTypes = todo Pexp_newtype; +let funcWithTypeLocallyAbstractTypes = (type atype(type btype(a, b, (c: atype => btype => unit)) => +c( + a, + b, +))); -type a = other type...; +type a = unit => unit; type b = - | Foo(other type...) - | Bar(other type..., other type..., other type...) - | Baz(other type..., other type..., other type...); + | Foo(unit => unit) + | Bar(unit => unit, unit => unit, a => b => c) + | Baz(unit => unit, unit => unit, a => b => c); type c = - | Foo(other type...) - | Bar(other type...); + | Foo(a => b => unit) + | Bar(a => b => unit); -type d = other type...; +type d = todo Ptyp_variant; /** * Records: @@ -604,7 +612,7 @@ type component2 = { }; type component3 = { - props: other type..., + props: M.props, state: state, }; @@ -620,17 +628,17 @@ type mutabeleComponent2 = { type description = { element: string, - tag: tag(todo a), + tag: tag('props), }; module Foo = {type bar = { - foo: other type..., + foo: Baz.foo, };}; type foo = { - bar: other type..., + bar: Baz.bar, qux: qux, - fooo: other type..., + fooo: Fooo.fooo, }; let moreFoo = {bar: Baz.bar, qux, fooo: Fooo.fooo}; @@ -649,11 +657,11 @@ let bar = {bar: 1, Foo.foo: foo}; let bar = {Foo.foo: foo, Bar.bar: bar}; -{Ppat_record: not supported, y} => 1; +{M.x: x, y} => 1; switch (foo) { -| {y: 1, Ppat_record: not supported} => 2 +| {y: 1, M.x: x} => 2 }; let break_after_equal = @@ -699,7 +707,7 @@ it( foo(preserveBraces => { inCallback}); -foo(preserveBraces => { inFirstPos},secondArg); +foo(preserveBraces => { inFirstPos}, secondArg); foo( From f7ef7c77e532848afdcf82bb2d344efea85614b5 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Fri, 26 May 2023 22:26:18 +0200 Subject: [PATCH 13/13] wip: improve parentheses handling --- Makefile | 1 + src/reason-parser/reason_pprint_ast_pprint.ml | 114 +++++--- test/basicStructures.t/run.t.new | 243 ++++++++---------- 3 files changed, 188 insertions(+), 170 deletions(-) diff --git a/Makefile b/Makefile index 9f7370819..a5e1f573f 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,7 @@ all-supported-ocaml-versions: pprint_test: ocamlformat src/reason-parser/reason_pprint_ast_pprint.ml -i + dune exec src/refmt/refmt_impl.exe -- test/basicStructures.t/input.re --parse re --print ast > test/basicStructures.t/run.t.ast dune exec src/refmt/refmt_impl.exe -- test/basicStructures.t/input.re --parse re --print re > test/basicStructures.t/run.t.new doc: diff --git a/src/reason-parser/reason_pprint_ast_pprint.ml b/src/reason-parser/reason_pprint_ast_pprint.ml index e7110b10f..0e2dc39e0 100644 --- a/src/reason-parser/reason_pprint_ast_pprint.ml +++ b/src/reason-parser/reason_pprint_ast_pprint.ml @@ -633,7 +633,9 @@ let higherPrecedenceThan c1 c2 = | Some (_, p1), Some (_, p2) -> p1 < p2 let printedStringAndFixityExpr = function - | { pexp_desc = Pexp_ident { txt = Lident l } } -> printedStringAndFixity l + | { pexp_desc = Pexp_ident { txt = Lident op } } -> + let op = Reason_syntax_util.ml_to_reason_swap op in + printedStringAndFixity op | _ -> Normal (* which identifiers are in fact operators needing parentheses *) @@ -1108,10 +1110,20 @@ and constant c = and direction_flag (f : Compiler_libs.Asttypes.direction_flag) = match f with Upto -> string "to" | Downto -> string "downto" -and expression ?(depth = 0) ?(wrap = true) x = +(* and is_unary_operator txt = + match txt with + | "not" -> true + | op when String.length op > 0 && List.mem op.[0] almost_simple_prefix_symbols + -> + true + | _ -> false *) + +and expression ?(depth = 0) ?(wrap = false) x = let { pexp_desc; pexp_loc; pexp_loc_stack; pexp_attributes } = x in match pexp_desc with | Pexp_ident { txt = Lident "not" } -> bang + | Pexp_ident { txt = Lident x } -> + string (Reason_syntax_util.ml_to_reason_swap x) | Pexp_ident { txt } -> longident txt | Pexp_constant c -> constant c | Pexp_let (rf, vb, e) -> @@ -1147,36 +1159,55 @@ and expression ?(depth = 0) ?(wrap = true) x = in arg_label a ^^ args ^^ arrow ^^ callback | Pexp_apply - ( ({ pexp_desc = Pexp_ident { txt = Lident i; _ }; _ } as infixOperator), - ([ (_, a); (_, b) ] as l) ) -> ( - match printedStringAndFixity i with - | Infix o -> expression a ^^ space ^^ string o ^^ space ^^ expression b - | Normal -> - (* this should be merged with Pexp_apply (e, l) *) - group - (ifflat - (expression infixOperator ^^ lparen - ^^ separate_map (comma ^^ space) (fun (_, e) -> expression e) l - ^^ rparen) - (group - (break 0 ^^ expression infixOperator ^^ lparen - ^^ nest 2 - (break 0 - ^^ separate_map - (comma ^^ break 1) - (fun (_, e) -> expression ~wrap:false e) - l - ^^ ifflat empty - (if List.length l = 1 then empty else comma)) - ^^ break 0 ^^ rparen))) - | _ -> - expression a ^^ space ^^ expression infixOperator ^^ space - ^^ expression b) + (({ pexp_desc = Pexp_ident { txt = Lident op; _ }; _ } as e_op), l1) -> ( + let needs_parens = + match l1 with + | [] -> false + | (Nolabel, { pexp_desc = Pexp_ident _; _ }) :: _ + | (Nolabel, { pexp_desc = Pexp_send _; _ }) :: _ + | (Nolabel, { pexp_desc = Pexp_field _; _ }) :: _ -> + false + | (Nolabel, { pexp_desc = Pexp_apply _; _ }) :: _ -> true + | _ -> true + in + + let l = + separate_map (comma ^^ break 1) (fun (_, e) -> expression ~wrap e) l1 + in + let op = Reason_syntax_util.ml_to_reason_swap op in + match printedStringAndFixity op with + | UnaryPlusPrefix _ | UnaryMinusPrefix _ | UnaryNotPrefix _ + | AlmostSimplePrefix _ + when needs_parens -> + expression ~wrap:true e_op ^^ lparen ^^ l ^^ rparen + | UnaryPlusPrefix _ | UnaryMinusPrefix _ | UnaryNotPrefix _ + | AlmostSimplePrefix _ -> + expression ~wrap:true e_op ^^ l + | Normal -> ( + expression ~wrap e_op + ^^ + match l1 with + | [ + ( Nolabel, + { pexp_desc = Pexp_construct ({ txt = Lident "()"; _ }, _); _ } ); + ] -> + l + | _ -> lparen ^^ l ^^ rparen) + | Infix _ -> string "todo: Pexpl_apply infix" + | Letop _ -> string "todo: Pexpl_apply letop" + | Andop _ -> string "todo: Pexpl_apply andop" + | UnaryPostfix _ when needs_parens -> + lparen ^^ l ^^ rparen ^^ expression ~wrap:true e_op + | UnaryPostfix _ -> l ^^ expression ~wrap:true e_op) | Pexp_apply (e, l) -> let leftParen, rightParen = match l with | (_, { pexp_desc = Pexp_construct ({ txt = Lident "()"; _ }, _); _ }) - :: [] -> + :: [] + | (_, { pexp_desc = Pexp_ident { txt = Lident "not"; _ }; _ }) :: [] -> + (empty, empty) + | (_, { pexp_desc = Pexp_field _; _ }) :: [] + | (_, { pexp_desc = Pexp_send _; _ }) :: [] -> (empty, empty) | _ -> (lparen, rparen) in @@ -1184,11 +1215,11 @@ and expression ?(depth = 0) ?(wrap = true) x = (ifflat (expression e ^^ leftParen ^^ separate_map (comma ^^ space) - (fun (_, e) -> expression ~wrap:false e) + (fun (_, e) -> expression ~wrap:true e) l ^^ rightParen) (group - (break 0 ^^ expression e ^^ leftParen + (break 0 ^^ expression e ~wrap:true ^^ leftParen ^^ nest 2 (break 0 ^^ separate_map @@ -1245,10 +1276,29 @@ and expression ?(depth = 0) ?(wrap = true) x = l) ^^ ifflat empty comma ^^ break 0 ^^ rbrace) | Pexp_field (e, li) -> + let needsParens = + match e.pexp_desc with + | Pexp_apply (ee, _) -> ( + match printedStringAndFixityExpr ee with + | AlmostSimplePrefix _ | UnaryPlusPrefix _ | UnaryMinusPrefix _ + | UnaryNotPrefix _ | UnaryPostfix _ -> + wrap + | _ -> false) + | _ -> false + in + + (* let lhs = expression e in + let lhs = if needparens then lparen ^^ lhs ^^ rparen else lhs in + lhs ^^ string "#" ^^ string s.txt + *) let _prec = Token "." in - let leftItm = expression e in + let leftItm = expression ~wrap:true e in let { stdAttrs } = partitionAttributes e.pexp_attributes in let formattedLeftItm = if stdAttrs == [] then leftItm else leftItm in + let formattedLeftItm = + if needsParens then lparen ^^ formattedLeftItm ^^ rparen + else formattedLeftItm + in let layout = group (formattedLeftItm ^^ dot ^^ longident li.txt) in layout (* SpecificInfixPrecedence @@ -1286,7 +1336,7 @@ and expression ?(depth = 0) ?(wrap = true) x = match e.pexp_desc with | Pexp_apply (ee, _) -> ( match printedStringAndFixityExpr ee with - | UnaryPostfix "^" -> true + | UnaryPostfix _ -> true | _ -> false) | _ -> false in diff --git a/test/basicStructures.t/run.t.new b/test/basicStructures.t/run.t.new index bca02a1dc..80e90d93c 100644 --- a/test/basicStructures.t/run.t.new +++ b/test/basicStructures.t/run.t.new @@ -16,91 +16,81 @@ for (i in 0 to 5) { } }; -for (i in 0 to -endOfRangeMustBeSimple( - expr, - soWrap, -)) { +for (i in 0 to endOfRangeMustBeSimple(expr, +soWrap)) { print_int(i); print_newline(); - for (i in theSame(isTrue, ofThe, startOfRange) downto 0) { + for (i in theSame(isTrue, + ofThe, + startOfRange) downto 0) { print_string("Counting in reverse direction"); print_newline() } }; -let x = (!)((!)((!)(foo)).bar); +let x = ((foo^)^).bar^; -let x = (!)(foo.bar); +let x = foo.bar^; -let x = (!)(foo#bar); +let x = foo#bar^; -let x = (!)((!)(foo).bar); +let x = (foo^).bar^; -let x = (!)((!)(foo)#bar); +let x = (foo^)#bar^; -let x = !(!(!(foo)).bar); +let x = !(!(!foo)).bar; -let x = !(foo.bar); +let x = !foo.bar; -let x = !(foo#bar); +let x = !foo#bar; -let x = !(!(foo).bar); +let x = !(!foo).bar; -let x = !(!(foo)#bar); +let x = !!foo#bar; -let x = !(!(foo.bar)); +let x = !(!foo.bar); -let x = (?!)(!(foo.bar)); +let x = ?!(!foo.bar); -let x = !((?!)(foo.bar)); +let x = !(?!foo.bar); -let x = (~!)(!(foo.bar)); +let x = ~!(!foo.bar); -let x = !((~!)(foo.bar)); +let x = !(~!foo.bar); -let x = (~!)((~!)(foo.bar)); +let x = ~!(~!foo.bar); -let x = (!!)(foo.bar); +let x = !!foo.bar; -let x = (!!)(foo#bar); +let x = !!foo#bar; -let x = (!~)(foo.bar); +let x = !~foo.bar; -let x = (!~)(foo#bar); +let x = !~foo#bar; -let noParensNeeded = !(blah.foo.bar); +let noParensNeeded = !blah.foo.bar; -let parensNeededAroundFirst = !(blah).foo.bar; +let parensNeededAroundFirst = (!blah).foo.bar; -let parensNeededAroundSecond = !(blah.foo).bar; +let parensNeededAroundSecond = (!blah.foo).bar; -let noParensNeeded = !(blah#foo#bar); +let noParensNeeded = !blah#foo#bar; -let parensNeededAroundFirst = !(blah)#foo#bar; +let parensNeededAroundFirst = !blah#foo#bar; -let parensNeededAroundSecond = !(blah#foo)#bar; +let parensNeededAroundSecond = !blah#foo#bar; -let parensWithSpaceNeededAroundFirst = !(!(blah))#foo#bar; +let parensWithSpaceNeededAroundFirst = !(!blah)#foo#bar; -let parensWithSpaceNeededAroundSecond = -!( - !(blah#foo) -)#bar; +let parensWithSpaceNeededAroundSecond = !(!blah#foo)#bar; -let parensWithSpaceNeededAroundFirst = -(?!)( - (~+)(blah) -)#foo#bar; +let parensWithSpaceNeededAroundFirst = ?!(~+blah)#foo#bar; -let parensWithSpaceNeededAroundSecond = -(?!)( - (~+)(blah#foo) -)#bar; +let parensWithSpaceNeededAroundSecond = ?!(~+blah#foo)#bar; -let x = !(!(foo.bar)); +let x = !(!foo.bar); -let x = !(!(foo#bar)); +let x = !(!foo#bar); let x = -10; @@ -130,17 +120,17 @@ let lazy lazy true = 10; let lazy [%extend] = 10; -let x = Array.get((!)(arr), 0); +let x = Array.get(arr^, 0); -let x = Array.get((!)(arr), 0); +let x = Array.get(arr^, 0); -let x = String.get((!)(str), 0); +let x = String.get(str^, 0); -let x = String.get((!)(str), 0); +let x = String.get(str^, 0); -let x = Array.set((!)(arr), 0, 1); +let x = Array.set(arr^, 0, 1); -let x = Array.set((!)(arr), 0, 1); +let x = Array.set(arr^, 0, 1); /**/ @@ -148,7 +138,7 @@ let x = Array.set((!)(arr), 0, 1); *============================================================================ */ -let /++ = (+); +let /++ = +; let something = if (self.ext.logSuccess) { print_string("Did tap"); @@ -166,22 +156,23 @@ let logTapSuccess = self => if (self.ext.logSuccess) { print_newline() }; -!(data).true; +!data.true; -!(data).field1.true; +(!data).field1.true; -!(data.field1).true; +!data.field1.true; -!(data).field1.true; +(!data).field1.true; -!(data.field1).true; +!data.field1.true; let loop = (appTime, frameTime) => if (hasSetup.contents) { setupScene(); renderIntoTop(); hasSetup.true }; -process(appTime, frameTime); +process(appTime, +frameTime); if (something) { if (somethingElse) { @@ -221,19 +212,16 @@ if (false) { let printIfFirstArgGreater = true; let result = if (printIfFirstArgGreater) { - (a, b) => if (a > b) { + (a, b) => if (todo: Pexpl_apply infix) { print_string("a > b") } else print_string("b >= a") } -else if ((a, b) => if (a > b) { +else if ((a, b) => if (todo: Pexpl_apply infix) { print_string("b < a") } else print_string("a <= b")) { - - print_string( - "That could never possibly type check" - ); + print_string("That could never possibly type check"); print_newline() }; @@ -252,35 +240,37 @@ let myRecord = { }; if (printIfFirstArgGreater) { - (a, b) => if (a > b) { + (a, b) => if (todo: Pexpl_apply infix) { print_string("a > b") } } -else (a, b) => if (a > b) { +else (a, b) => if (todo: Pexpl_apply infix) { print_string("b < a") }; if (printIfFirstArgGreater) { - (a, b) => if (a > b) { + (a, b) => if (todo: Pexpl_apply infix) { print_string("a > b") } - else (a, b) => if (a > b) { + else (a, b) => if (todo: Pexpl_apply infix) { print_string("b < a") } }; -(a, b) => if (a > b) { print_string("a > b") }; +(a, b) => if (todo: Pexpl_apply infix) { + print_string("a > b") + }; if (printIfFirstArgGreater) { - (a, b) => if (a > b) { + (a, b) => if (todo: Pexpl_apply infix) { print_string("a > b") } } -else (a, b) => if (a > b) { +else (a, b) => if (todo: Pexpl_apply infix) { print_string("b < a") }; -if (10 < 100) { +if (todo: Pexpl_apply infix) { let msg = "If there was any doubt, 10 is in fact less than 100."; print_string(msg); @@ -289,11 +279,8 @@ else let msg = "All bets are off."; print_string(msg);; -if (10 < 100) { - - print_string( - "If there was any doubt, 10 is in fact less than 100." - ) +if (todo: Pexpl_apply infix) { + print_string("If there was any doubt, 10 is in fact less than 100.") } else print_string("All bets are off."); @@ -329,16 +316,13 @@ let annotatingFuncApplication = ( (_dummyFunc("a"): int), ); -let annotatingSingleFuncApplication = ( -_dummyFunc( - "a" -): int); +let annotatingSingleFuncApplication = (_dummyFunc("a"): int); let annotatingSingleFuncApplication = let a = 100; let int = 200; -2 + (_dummyFunc(a): int);;; +todo: Pexpl_apply infix;;; let ( (tupleItem: int), @@ -371,16 +355,14 @@ let result = (["appendedToHead", "append", "to"]: list(string)); -let rec size = ( - fun - | [] => 0 - | [hd, ...tl] => 1 + size(tl) -); +let rec size = fun +| [] => 0 +| [hd, ...tl] => todo: Pexpl_apply infix; let rec size = (soFar, lst) => switch (lst) { | [] => 0 -| [hd, ...tl] => size(soFar + 1, tl) +| [hd, ...tl] => size(todo: Pexpl_apply infix, tl) }; let nestedMatch = lstLst => @@ -388,8 +370,8 @@ switch (lstLst) { | [hd, ...tl] when false => 10 | [hd, ...tl] => switch (tl) { - | [] => 0 + 0 - | [tlHd, ...tlTl] => 0 + 1 + | [] => todo: Pexpl_apply infix + | [tlHd, ...tlTl] => todo: Pexpl_apply infix } | [] => 0 }; @@ -399,9 +381,9 @@ switch (lstLst) { | [hd, ...tl] when false => 10 | [hd, ...tl] when true => switch (tl) { - | [] when false => 0 + 0 - | [] when true => 0 + 0 - | [tlHd, ...tlTl] => 0 + 1 + | [] when false => todo: Pexpl_apply infix + | [] when true => todo: Pexpl_apply infix + | [tlHd, ...tlTl] => todo: Pexpl_apply infix } | [] => 0 }; @@ -476,18 +458,15 @@ let myTuple = (( (two: int), ): myTupleType); -let addValues = ((a: int), (b: int)) => a + b; +let addValues = ((a: int), (b: int)) => todo: Pexpl_apply infix; -let addValues = ((a: int), (b: int)) => a + b; +let addValues = ((a: int), (b: int)) => todo: Pexpl_apply infix; -let myFunction = ((a: int), (b: int)) => (a + b: int); +let myFunction = ((a: int), (b: int)) => (todo: Pexpl_apply infix: int); -let functionReturnValueType = ((i: int), (s: string)) => (x => x + 1: int => int); +let functionReturnValueType = ((i: int), (s: string)) => (x => todo: Pexpl_apply infix: int => int); -let curriedFormOne = ((i: int), (s: string)) => s (^) -string_of_int( - i -); +let curriedFormOne = ((i: int), (s: string)) => todo: Pexpl_apply infix; let curriedFormTwo = ((i: int), (x: int)) => (( i, @@ -511,13 +490,10 @@ let curriedFormThree = ((i: int), (( type myFuncType = int => int => int; -let myFunc = ((a, b) => a + b: myFuncType); +let myFunc = ((a, b) => todo: Pexpl_apply infix: myFuncType); -let funcWithTypeLocallyAbstractTypes = (type atype(type btype(a, b, (c: atype => btype => unit)) => -c( - a, - b, -))); +let funcWithTypeLocallyAbstractTypes = (type atype(type btype(a, b, (c: atype => btype => unit)) => c(a, +b))); type a = unit => unit; @@ -551,7 +527,7 @@ let testRecord = { let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; let makeRecordBase = () => { @@ -562,37 +538,37 @@ let makeRecordBase = () => { let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; let anotherRecord = { name: "joe++", - age: testRecord.age + 10, + age: todo: Pexpl_apply infix, }; type props = { @@ -664,10 +640,7 @@ switch (foo) { | {y: 1, M.x: x} => 2 }; -let break_after_equal = -no_break_from_here( - some_call(to_here) -); +let break_after_equal = no_break_from_here(some_call(to_here)); let () = todo Pexp_letexception; @@ -694,26 +667,20 @@ let identifierLambda = a => (); let underscoreLambda = _ => (); +it("should remove parens", +a => { + print_string("did it work?"); + print_string("did it work?") +}); -it( - "should remove parens", - a => { - print_string("did it work?"); - print_string("did it work?") - }, -); - -(!)(curNode) ## childNodes; +todo: Pexpl_apply infix; foo(preserveBraces => { inCallback}); foo(preserveBraces => { inFirstPos}, secondArg); - -foo( - oneArg, - preserveBraces => { - inFirstPos - }, - secondArg, -); +foo(oneArg, +preserveBraces => { + inFirstPos +}, +secondArg);