Skip to content

Commit

Permalink
Pick tests added in #2544 (#2588)
Browse files Browse the repository at this point in the history
This will make the changes in #2544 easier to interpret.
  • Loading branch information
Julow authored Oct 14, 2024
1 parent 9dbce34 commit 51800ac
Show file tree
Hide file tree
Showing 18 changed files with 318 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/passing/tests/break_fun_decl-fit_or_vertical.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,20 @@ let f
(module Store : Irmin.Generic_key.S with type repo = repo)
(module Store : Irmin.Generic_key.S with type repo = repo) =
body

(* Inconsistent formatting of fun arguments. *)

let new_specialised_args =
Variable.Map.mapi
(fun new_inner_var______ (definition : Definition.t) :
Flambda.specialised_to -> () )
foo

let new_specialised_args =
Variable.Map.mapi
(fun
new_inner_var______
(definition : Definition.t)
:
Flambda.specialised_to
-> () )
17 changes: 17 additions & 0 deletions test/passing/tests/break_fun_decl-smart.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,20 @@ let f
(module Store : Irmin.Generic_key.S with type repo = repo)
(module Store : Irmin.Generic_key.S with type repo = repo) =
body

(* Inconsistent formatting of fun arguments. *)

let new_specialised_args =
Variable.Map.mapi
(fun new_inner_var______ (definition : Definition.t) :
Flambda.specialised_to -> () )
foo

let new_specialised_args =
Variable.Map.mapi
(fun
new_inner_var______
(definition : Definition.t)
:
Flambda.specialised_to
-> () )
17 changes: 17 additions & 0 deletions test/passing/tests/break_fun_decl-wrap.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,20 @@ let _ =
let f (module Store : Irmin.Generic_key.S with type repo = repo)
(module Store : Irmin.Generic_key.S with type repo = repo) =
body

(* Inconsistent formatting of fun arguments. *)

let new_specialised_args =
Variable.Map.mapi
(fun new_inner_var______ (definition : Definition.t) :
Flambda.specialised_to -> () )
foo

let new_specialised_args =
Variable.Map.mapi
(fun
new_inner_var______
(definition : Definition.t)
:
Flambda.specialised_to
-> () )
17 changes: 17 additions & 0 deletions test/passing/tests/break_fun_decl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,20 @@ let _ =
let f (module Store : Irmin.Generic_key.S with type repo = repo)
(module Store : Irmin.Generic_key.S with type repo = repo) =
body

(* Inconsistent formatting of fun arguments. *)

let new_specialised_args =
Variable.Map.mapi
(fun new_inner_var______ (definition : Definition.t) :
Flambda.specialised_to -> () )
foo

let new_specialised_args =
Variable.Map.mapi
(fun
new_inner_var______
(definition : Definition.t)
:
Flambda.specialised_to
-> () )
10 changes: 10 additions & 0 deletions test/passing/tests/class_expr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ class c `I = x
class c i = x

class c (* xx *) i (* yy *) = x

class c =
object
method class_infos : 'a. ('a -> 'res) -> 'a class_infos -> 'res =
fun _a
{pci_virt; pci_params; pci_name; pci_expr; pci_loc; pci_attributes} ->
let pci_virt = self#virtual_flag pci_virt in
let pci_params = self#list in
()
end
1 change: 1 addition & 0 deletions test/passing/tests/class_expr.ml.err
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warning: tests/class_expr.ml:12 exceeds the margin
13 changes: 13 additions & 0 deletions test/passing/tests/fun_decl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,16 @@ let space_break =
with_pp (fun fs ->
Box_debug.space_break fs ;
Format_.pp_print_space fs () )
let _ =
(fun k ->
let _ = 42 in
() )
@@ ()
let _ =
let _ = () in
fun (context : Context.t)
~(local_bins : origin Appendable_list.t Filename.Map.t Memo.Lazy.t) ->
let _ = () in
()
16 changes: 16 additions & 0 deletions test/passing/tests/function_indent-never.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ let foooooooo =
else function
| fooooooooooooooooooooooo -> foooooooooooooooooooooooooo
| fooooooooooooooooooooooo -> foooooooooooooooooooooooooo

let _ =
{ foo=
(fun _ -> function
| _ ->
let _ = 42 in
()
| () -> () ) }

let _ =
match () with
| _ -> (
f
>>= function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2 )
18 changes: 18 additions & 0 deletions test/passing/tests/function_indent.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,21 @@ let foooooooo =
function
| fooooooooooooooooooooooo -> foooooooooooooooooooooooooo
| fooooooooooooooooooooooo -> foooooooooooooooooooooooooo

let _ =
{ foo =
(fun _ -> function
| _ ->
let _ = 42 in
()
| () -> ())
}
;;

let _ =
match () with
| _ -> (
f
>>= function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2 )
16 changes: 16 additions & 0 deletions test/passing/tests/function_indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ let foooooooo =
else function
| fooooooooooooooooooooooo -> foooooooooooooooooooooooooo
| fooooooooooooooooooooooo -> foooooooooooooooooooooooooo

let _ =
{ foo=
(fun _ -> function
| _ ->
let _ = 42 in
()
| () -> () ) }

let _ =
match () with
| _ -> (
f
>>= function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2 )
37 changes: 37 additions & 0 deletions test/passing/tests/js_source.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8193,3 +8193,40 @@ end
]
;;
*)

let _ =
{ foo =
(fun _ -> function
| _ ->
let _ = 42 in
()
| () -> ())
}
;;

let _ =
match () with
| _ ->
f
>>= (function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2)
;;

let _ =
match () with
| _ ->
f
>>= (function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2)
>>= foo
;;

let exists t key =
S.Tree.kind t.tree (path key)
>|= function
| Some `Contents -> Ok (Some `Value)
| Some `Node -> Ok (Some `Dictionary)
| None -> Ok None
;;
37 changes: 37 additions & 0 deletions test/passing/tests/js_source.ml.ocp
Original file line number Diff line number Diff line change
Expand Up @@ -10476,3 +10476,40 @@ module type M = sig
end

(*$ let _ = [ x (* *); y ] *)

let _ =
{ foo =
(fun _ -> function
| _ ->
let _ = 42 in
()
| () -> ())
}
;;

let _ =
match () with
| _ ->
f
>>= (function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2)
;;

let _ =
match () with
| _ ->
f
>>= (function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2)
>>= foo
;;

let exists t key =
S.Tree.kind t.tree (path key)
>|= function
| Some `Contents -> Ok (Some `Value)
| Some `Node -> Ok (Some `Dictionary)
| None -> Ok None
;;
37 changes: 37 additions & 0 deletions test/passing/tests/js_source.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -10476,3 +10476,40 @@ module type M = sig
end

(*$ let _ = [ x (* *); y ] *)

let _ =
{ foo =
(fun _ -> function
| _ ->
let _ = 42 in
()
| () -> ())
}
;;

let _ =
match () with
| _ ->
f
>>= (function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2)
;;

let _ =
match () with
| _ ->
f
>>= (function
| `Fooooooooooooooooooooooooooooooooooooooo -> 1
| `Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar -> 2)
>>= foo
;;

let exists t key =
S.Tree.kind t.tree (path key)
>|= function
| Some `Contents -> Ok (Some `Value)
| Some `Node -> Ok (Some `Dictionary)
| None -> Ok None
;;
19 changes: 19 additions & 0 deletions test/passing/tests/labelled_args-414.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ let () =
very_long_argument_name_two
very_long_argument_name_three
-> () )

let () =
very_long_function_name
~very_long_argument_label:(fun
very_long_argument_name_one
very_long_argument_name_two
very_long_argument_name_three
-> () )
foo

let () =
very_long_function_name
~very_long_argument_label:(* foo *)
(fun
very_long_argument_name_one
very_long_argument_name_two
very_long_argument_name_three
-> () )
foo
19 changes: 19 additions & 0 deletions test/passing/tests/labelled_args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ let () =
very_long_argument_name_two
very_long_argument_name_three
-> () )

let () =
very_long_function_name
~very_long_argument_label:(fun
very_long_argument_name_one
very_long_argument_name_two
very_long_argument_name_three
-> () )
foo

let () =
very_long_function_name
~very_long_argument_label:(* foo *)
(fun
very_long_argument_name_one
very_long_argument_name_two
very_long_argument_name_three
-> () )
foo
9 changes: 9 additions & 0 deletions test/passing/tests/source-conventional.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -8697,3 +8697,12 @@ let eradicate_meta_class_is_nullsafe =
~enabled:false Info

let () = match () with _ -> ( fun _ : _ -> match () with _ -> ()) | _ -> ()

let f = function
| Foo -> bar
| EArr l ->
EArr
(List.map l ~f:(function
| ElementHole -> ElementHole
| Element e -> Element (m#expression e)
| ElementSpread e -> ElementSpread (m#expression e)))
9 changes: 9 additions & 0 deletions test/passing/tests/source.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7423,3 +7423,12 @@ let () =
| _ -> ())
| _ -> ()
;;

let f = function
| Foo -> bar
| EArr l ->
EArr
(List.map l ~f:(function
| ElementHole -> ElementHole
| Element e -> Element (m#expression e)
| ElementSpread e -> ElementSpread (m#expression e)))
9 changes: 9 additions & 0 deletions test/passing/tests/source.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -9201,3 +9201,12 @@ let eradicate_meta_class_is_nullsafe =

let () =
match () with _ -> ( fun _ : _ -> match () with _ -> () ) | _ -> ()

let f = function
| Foo -> bar
| EArr l ->
EArr
(List.map l ~f:(function
| ElementHole -> ElementHole
| Element e -> Element (m#expression e)
| ElementSpread e -> ElementSpread (m#expression e) ) )

0 comments on commit 51800ac

Please sign in to comment.