ligo/test/test-locations.mlt

28 lines
497 B
Plaintext
Raw Normal View History

2016-03-09 19:44:54 +04:00
(* -*- tuareg -*- *)
module Let_syntax = struct
type 'a t = T of 'a
2019-01-16 14:57:51 +04:00
2016-03-09 19:44:54 +04:00
let map (T x) ~f = T (f x)
let both (T x) (T y) = T (x, y)
2019-01-16 14:57:51 +04:00
2016-03-09 19:44:54 +04:00
module Open_on_rhs = struct
let return x = T x
2019-01-16 14:57:51 +04:00
let f x ~(doc : string) = T (x, doc)
2016-03-09 19:44:54 +04:00
end
end
2019-01-16 14:57:51 +04:00
let _ =
[%map_open
let x = return 42
and y = f 42 in
()]
;;
[%%expect
{|
Line _, characters 12-16:
2016-07-12 20:08:10 +04:00
Error: This expression has type doc:string -> (int * string) Let_syntax.t
2016-03-09 19:44:54 +04:00
but an expression was expected of type 'a Let_syntax.t
|}]