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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
(* sharing.sml *)
(* Checks treatment of sharing constraints. *)
signature S =
sig
type t
type s = t
sharing type t = s
end;
signature T = (* from SML/NJ doc *)
sig
type s
structure A :
sig
datatype d = D of s
datatype t = K
end
sharing type s = A.t
end;
(* Check that multiple sharing equations is all pairs. *)
signature S =
sig
structure T: sig end
structure U: sig type t = int end
sharing T = U
end
functor F (structure A: sig type t end
structure B: sig end
structure C: sig type t end
sharing A = B = C) =
struct
val _: A.t -> C.t = fn x => x
end
functor F (structure A: sig type t end
structure B: sig type u end
structure C: sig type t end
structure D: sig type u end
sharing A = B = C = D) =
struct
val _: A.t -> C.t = fn x => x
val _: B.u -> D.u = fn x => x
end
(* Check that sharing doesn't mistakenly share structures that only differ in
* free flexible tycons.
*)
signature T =
sig
type t
structure U:
sig
val x: t
end
end
structure S:
sig
structure T1: T
structure T2: T
sharing T1.U = T2.U
end =
struct
structure T1 =
struct
type t = int
structure U =
struct
val x = 13
end
end
structure T2 =
struct
type t = real
structure U =
struct
val x = 13.0
end
end
end
;
|