test/test-dup-pattern.mlt
raw| 1 | module Let_syntax = struct |
| 2 | type 'a t = T of 'a |
| 3 | |
| 4 | let map (T x) ~f = T (f x) |
| 5 | let both (T x) (T y) = T (x, y) |
| 6 | |
| 7 | module Open_on_rhs = struct |
| 8 | let return x = T x |
| 9 | let f x ~(doc : string) = T (x, doc) |
| 10 | end |
| 11 | end |
| 12 | |
| 13 | let (_ : _) = |
| 14 | (* This tests whether we correctly detect that `let x : t = e` |
| 15 | has been rewritten into `let x : t = (e : t)` (and undo the |
| 16 | change). A typing error occurs *) |
| 17 | let%map_open _x : int Let_syntax.t = return 42 in |
| 18 | () |
| 19 | ;; |