forked from ocaml/merlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[B] Fix type enclosing for binding operators ocaml#1653
test: test enclosing type for let+ ... and+ ... in expression from Alizter/ps/branch/test__test_enclosing_type_for_let______and______in_expression
- Loading branch information
Showing
9 changed files
with
80 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
let (let+) x f = Option.map f x | ||
|
||
let (and+) x y = | ||
Option.bind x @@ fun x -> | ||
Option.map (fun y -> (x, y)) y | ||
|
||
let minus_three (tbl1, tbl2) (key1, key2) = | ||
let+ foo = Hashtbl.find_opt tbl1 key1 | ||
and+ bar = Hashtbl.find_opt tbl2 key2 | ||
and+ man = Hashtbl.find_opt tbl2 key2 in | ||
foo + bar - man |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Various parts of the letop together with andop: | ||
|
||
- The let+ operator: | ||
$ $MERLIN single type-enclosing -position 8:4 -verbosity 0 \ | ||
> -filename ./letop.ml < ./letop.ml | jq ".value[0:2]" | ||
[ | ||
{ | ||
"start": { | ||
"line": 8, | ||
"col": 2 | ||
}, | ||
"end": { | ||
"line": 8, | ||
"col": 6 | ||
}, | ||
"type": "'a option -> ('a -> 'b) -> 'b option", | ||
"tail": "no" | ||
}, | ||
{ | ||
"start": { | ||
"line": 8, | ||
"col": 2 | ||
}, | ||
"end": { | ||
"line": 8, | ||
"col": 6 | ||
}, | ||
"type": "((int * int) * int) option -> ((int * int) * int -> int) -> int option", | ||
"tail": "no" | ||
} | ||
] |