Skip to content

Commit ba19a2b

Browse files
authored
Enable layout histories (#1823)
* enable display_histories * accept test changes and mark them as unreviewed * improve CR messages for unreviewed tests --------- Co-authored-by: Alan Chang <[email protected]>
1 parent ff470b6 commit ba19a2b

File tree

27 files changed

+1127
-225
lines changed

27 files changed

+1127
-225
lines changed

ocaml/testsuite/tests/typing-immediate/immediate.ml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(* TEST
22
* expect
33
*)
4+
(* CR layouts v2.9: all error messages below here are unreviewed *)
45

56
module type S = sig type t [@@immediate] end;;
67
module F (M : S) : S = M;;
@@ -143,7 +144,11 @@ end;;
143144
Line 2, characters 2-31:
144145
2 | type t = string [@@immediate]
145146
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146-
Error: Type string has layout value, which is not a sublayout of immediate.
147+
Error: The layout of Type string is value, because
148+
it equals the primitive value type string.
149+
But the layout of Type string must be a sublayout of immediate, because
150+
of the annotation on the declaration of the type t.
151+
147152
|}];;
148153

149154
(* Cannot directly declare a non-immediate type as immediate (variant) *)
@@ -154,7 +159,11 @@ end;;
154159
Line 2, characters 2-41:
155160
2 | type t = Foo of int | Bar [@@immediate]
156161
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157-
Error: Type t has layout value, which is not a sublayout of immediate.
162+
Error: The layout of Type t is value, because
163+
a boxed variant.
164+
But the layout of Type t must be a sublayout of immediate, because
165+
of the annotation on the declaration of the type t/2.
166+
158167
|}];;
159168

160169
(* Cannot directly declare a non-immediate type as immediate (record) *)
@@ -165,7 +174,11 @@ end;;
165174
Line 2, characters 2-38:
166175
2 | type t = { foo : int } [@@immediate]
167176
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168-
Error: Type t has layout value, which is not a sublayout of immediate.
177+
Error: The layout of Type t is value, because
178+
a boxed record.
179+
But the layout of Type t must be a sublayout of immediate, because
180+
of the annotation on the declaration of the type t/3.
181+
169182
|}];;
170183

171184
(* Not guaranteed that t is immediate, so this is an invalid declaration *)
@@ -177,7 +190,11 @@ end;;
177190
Line 3, characters 2-26:
178191
3 | type s = t [@@immediate]
179192
^^^^^^^^^^^^^^^^^^^^^^^^
180-
Error: Type t has layout value, which is not a sublayout of immediate.
193+
Error: The layout of Type t is value, because
194+
the default layout for an abstract type.
195+
But the layout of Type t must be a sublayout of immediate, because
196+
of the annotation on the declaration of the type s.
197+
181198
|}];;
182199

183200
(* Can't ascribe to an immediate type signature with a non-immediate type *)
@@ -198,7 +215,11 @@ Error: Signature mismatch:
198215
type t = string
199216
is not included in
200217
type t : immediate
201-
the first has layout value, which is not a sublayout of immediate.
218+
The layout of the first is value, because
219+
it equals the primitive value type string.
220+
But the layout of the first must be a sublayout of immediate, because
221+
of the annotation on the declaration of the type t.
222+
202223
|}];;
203224

204225
(* Same as above but with explicit signature *)
@@ -214,7 +235,11 @@ Error: Signature mismatch:
214235
type t = string
215236
is not included in
216237
type t : immediate
217-
the first has layout value, which is not a sublayout of immediate.
238+
The layout of the first is value, because
239+
it equals the primitive value type string.
240+
But the layout of the first must be a sublayout of immediate, because
241+
of the annotation on the declaration of the type t.
242+
218243
|}];;
219244

220245
(* Can't use a non-immediate type even if mutually recursive *)
@@ -226,7 +251,11 @@ end;;
226251
Line 2, characters 2-26:
227252
2 | type t = s [@@immediate]
228253
^^^^^^^^^^^^^^^^^^^^^^^^
229-
Error: Type s has layout value, which is not a sublayout of immediate.
254+
Error: The layout of Type s is value, because
255+
it equals the primitive value type string.
256+
But the layout of Type s must be a sublayout of immediate, because
257+
of the annotation on the declaration of the type t/2.
258+
230259
|}];;
231260

232261

0 commit comments

Comments
 (0)