v0.11.117.19+179
This commit is contained in:
parent
1c3bd075d7
commit
bdb7fe397e
@ -109,7 +109,19 @@ let expand ~loc:_ ~path:_ ~arg:modul extension_name expr =
|
|||||||
| Pexp_let (Nonrecursive, bindings, expr) ->
|
| Pexp_let (Nonrecursive, bindings, expr) ->
|
||||||
let bindings =
|
let bindings =
|
||||||
List.map bindings ~f:(fun vb ->
|
List.map bindings ~f:(fun vb ->
|
||||||
|
let pvb_pat =
|
||||||
|
(* Temporary hack tentatively detecting that the parser
|
||||||
|
has expanded `let x : t = e` into `let x : t = (e : t)`.
|
||||||
|
|
||||||
|
For reference, here is the relevant part of the parser:
|
||||||
|
https://github.com/ocaml/ocaml/blob/4.07/parsing/parser.mly#L1628 *)
|
||||||
|
match vb.pvb_pat.ppat_desc, vb.pvb_expr.pexp_desc with
|
||||||
|
| Ppat_constraint (p, { ptyp_desc = Ptyp_poly ([], t1); _ }),
|
||||||
|
Pexp_constraint (_, t2) when phys_equal t1 t2 -> p
|
||||||
|
| _ -> vb.pvb_pat
|
||||||
|
in
|
||||||
{ vb with
|
{ vb with
|
||||||
|
pvb_pat;
|
||||||
pvb_expr = maybe_open extension_name ~to_open:(open_on_rhs ~modul) vb.pvb_expr;
|
pvb_expr = maybe_open extension_name ~to_open:(open_on_rhs ~modul) vb.pvb_expr;
|
||||||
})
|
})
|
||||||
in
|
in
|
||||||
|
@ -41,7 +41,7 @@ module Monad_example = struct
|
|||||||
return (x + y + (u * v))
|
return (x + y + (u * v))
|
||||||
|
|
||||||
let _mg a : _ X.t =
|
let _mg a : _ X.t =
|
||||||
let%map x = a in
|
let%map x : int X.t = a in
|
||||||
x + 1
|
x + 1
|
||||||
|
|
||||||
let _mg' a b c : _ X.t =
|
let _mg' a b c : _ X.t =
|
||||||
|
Loading…
Reference in New Issue
Block a user