summaryrefslogtreecommitdiff
path: root/testsuite/tests/letrec/mixing_value_closures_1.ml
blob: 6e274346a38f1b9d688becb7345b0ef4b9b207a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(***********************************************************************)
(*                                                                     *)
(*                                OCaml                                *)
(*                                                                     *)
(*          Gabriel Scherer, projet Gallium, INRIA Rocquencourt        *)
(*                                                                     *)
(*  Copyright 2012 Institut National de Recherche en Informatique et   *)
(*  en Automatique.  All rights reserved.  This file is distributed    *)
(*  under the terms of the Q Public License version 1.0.               *)
(*                                                                     *)
(***********************************************************************)

(* mixing values and closures may exercise interesting code paths *)
type t = A of (int -> int)
let test =
  let rec x = A f
  and f = function
    | 0 -> 2
    | n -> match x with A g -> g 0
  in assert (f 1 = 2)