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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
(* TEST
flags = "-dshape";
expect;
*)
let x = ()
[%%expect{|
{
"x"[value] -> <.0>;
}
val x : unit = ()
|}]
external y : int -> int = "%identity"
[%%expect{|
{
"y"[value] -> <.1>;
}
external y : int -> int = "%identity"
|}]
type t = A of foo
and foo = Bar
[%%expect{|
{
"foo"[type] -> {<.3>
"Bar"[constructor] -> {<.5>};
};
"t"[type] -> {<.2>
"A"[constructor] -> {<.4>};
};
}
type t = A of foo
and foo = Bar
|}]
module type S = sig
type t
end
[%%expect{|
{
"S"[module type] -> <.7>;
}
module type S = sig type t end
|}]
exception E
[%%expect{|
{
"E"[extension constructor] -> {<.8>};
}
exception E
|}]
type ext = ..
[%%expect{|
{
"ext"[type] -> <.9>;
}
type ext = ..
|}]
type ext += A | B
[%%expect{|
{
"A"[extension constructor] -> {<.10>};
"B"[extension constructor] -> {<.11>};
}
type ext += A | B
|}]
module M = struct
type ext += C
end
[%%expect{|
{
"M"[module] -> {<.13>
"C"[extension constructor] -> {<.12>};
};
}
module M : sig type ext += C end
|}]
module _ = struct
type t = Should_not_appear_in_shape
end
[%%expect{|
{}
|}]
module rec M1 : sig
type t = C of M2.t
end = struct
type t = C of M2.t
end
and M2 : sig
type t
val x : t
end = struct
type t = T
let x = T
end
[%%expect{|
{
"M1"[module] -> {
"t"[type] -> {<.27>
"C"[constructor] -> {<.28>};
};
};
"M2"[module] ->
{
"t"[type] -> {<.29>
"T"[constructor] -> {<.30>};
};
"x"[value] -> <.31>;
};
}
module rec M1 : sig type t = C of M2.t end
and M2 : sig type t val x : t end
|}]
class c = object end
[%%expect{|
{
"c"[type] -> <.32>;
"c"[class] -> <.32>;
"c"[class type] -> <.32>;
}
class c : object end
|}]
class type c = object end
[%%expect{|
{
"c"[type] -> <.35>;
"c"[class type] -> <.35>;
}
class type c = object end
|}]
type u = t
[%%expect{|
{
"u"[type] -> <.36>;
}
type u = t
|}]
|