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