Skip to content

Commit

Permalink
browse_raw: slightly improved support for letop (cf. #985)
Browse files Browse the repository at this point in the history
Still rudimentary though.
  • Loading branch information
trefis committed Jul 2, 2019
1 parent 6d7f0c4 commit 9973437
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
8 changes: 7 additions & 1 deletion src/ocaml/merlin_specific/408/browse_raw.ml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ let of_constructor_arguments = function
| Cstr_tuple cts -> list_fold of_core_type cts
| Cstr_record lbls -> list_fold of_label_declaration lbls

let of_bop { bop_op_path = _; bop_op_val = _; bop_exp; _ } =
of_expression bop_exp

let of_pat_extra (pat,_,_) = match pat with
| Tpat_constraint ct -> of_core_type ct
| Tpat_type _ | Tpat_unpack | Tpat_open _ -> id_fold
Expand Down Expand Up @@ -348,7 +351,10 @@ let of_expression_desc loc = function
of_module_expr me
| Texp_unreachable | Texp_extension_constructor _ ->
id_fold
| Texp_letop { body; _ } -> of_case body
| Texp_letop { let_; ands; body; _ } ->
of_bop let_ **
list_fold of_bop ands **
of_case body
| Texp_open (od, e) ->
app (Module_expr od.open_expr) ** of_expression e

Expand Down
44 changes: 22 additions & 22 deletions tests/type-enclosing/letop.t
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ Various parts of the letop:
{
"start": {
"line": 4,
"col": 2
"col": 13
},
"end": {
"line": 5,
"col": 9
"line": 4,
"col": 29
},
"type": "('a -> 'b) -> 'a option -> 'b option",
"type": "('a, 'b) Hashtbl.t -> 'a -> 'b option",
"tail": "no"
}
]
Expand All @@ -99,25 +99,25 @@ Various parts of the letop:
{
"start": {
"line": 4,
"col": 2
"col": 30
},
"end": {
"line": 5,
"col": 9
"line": 4,
"col": 33
},
"type": "('a -> 'b) -> 'a option -> 'b option",
"type": "('a, 'b) Hashtbl.t",
"tail": "no"
},
{
"start": {
"line": 3,
"col": 17
"line": 4,
"col": 30
},
"end": {
"line": 5,
"col": 9
"line": 4,
"col": 33
},
"type": "'a -> ('b -> 'c) -> 'b option -> 'c option",
"type": "('a, 'b) Hashtbl.t",
"tail": "no"
}
]
Expand All @@ -128,25 +128,25 @@ Various parts of the letop:
{
"start": {
"line": 4,
"col": 2
"col": 34
},
"end": {
"line": 5,
"col": 9
"line": 4,
"col": 37
},
"type": "('a -> 'b) -> 'a option -> 'b option",
"type": "'a",
"tail": "no"
},
{
"start": {
"line": 3,
"col": 17
"line": 4,
"col": 34
},
"end": {
"line": 5,
"col": 9
"line": 4,
"col": 37
},
"type": "'a -> ('b -> 'c) -> 'b option -> 'c option",
"type": "'a",
"tail": "no"
}
]
Expand Down

0 comments on commit 9973437

Please sign in to comment.