summaryrefslogtreecommitdiff
path: root/testsuite/tests/letrec-check/lazy_.ml
blob: 5af54bfe377cfc2ffe423d057ad765d00db15882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(* TEST
 expect;
*)

let rec a = lazy b and b = 3;;
[%%expect{|
Line 1, characters 12-18:
1 | let rec a = lazy b and b = 3;;
                ^^^^^^
Error: This kind of expression is not allowed as right-hand side of `let rec'
|}];;

let rec e = lazy (fun _ -> f) and f = ();;
[%%expect{|
val e : ('a -> unit) lazy_t = lazy <fun>
val f : unit = ()
|}];;

let rec x = lazy (Lazy.force x + Lazy.force x)
  ;;
[%%expect{|
val x : int Lazy.t = <lazy>
|}];;