Backport from sid to buster
[hcoop/debian/mlton.git] / regression / undetermined.sml
1 (* undetermined.sml *)
2
3 (* Checks inference for non-generalised types (aka "free type variables"). *)
4
5 val f = (fn x => x) (fn x => x)
6 structure A = struct end
7 val y = f 7
8 ;
9
10 structure A: sig val f: int -> int end =
11 struct
12 val f = (fn x => x) (fn x => x)
13 end
14 ;
15
16 structure A : sig val a : int list ref end =
17 struct
18 val a = ref nil
19 end
20 ;
21
22 val x = ref nil
23 val _ = 1 :: !x
24 ;
25 ;
26 ;
27 val _ =
28 let
29 val x = ref nil
30 val _ = 1 :: !x
31 in
32 ()
33 end
34 ;
35 (* 2.sml *)
36 val id = (fn x => x) (fn x => x)
37 val _ = id 13
38 ;
39 structure X =
40 struct
41 val id = (fn x => x) (fn x => x)
42 val _ = id 13
43 end
44 ;
45 (* 4.sml *)
46 datatype t = T
47 val id = (fn x => x) (fn x => x)
48 val _ = id T
49 ;
50 (* 5.sml *)
51 local
52 val id = (fn x => x) (fn x => x)
53 in
54 val _ = id 13
55 end
56 ;
57 (* 7.sml *)
58 val id = (fn x => x) (fn x => x)
59 val _ = id 13
60 val id = ()
61 ;