diff options
author | Sébastien Hinderer <Sebastien.Hinderer@inria.fr> | 2018-01-12 17:52:22 +0100 |
---|---|---|
committer | Sébastien Hinderer <Sebastien.Hinderer@inria.fr> | 2018-01-17 12:04:42 +0100 |
commit | c9de090c6bbfbe458d265004e739a926feb071b9 (patch) | |
tree | 6b4bdab9684b5271157298b1842ba84dbcc6678e | |
parent | ab8978858f9f91c35452f381609d336d7eeae403 (diff) | |
download | ocaml-c9de090c6bbfbe458d265004e739a926feb071b9.tar.gz |
Migrate tests/typing-unboxed-types test to ocamltest
-rw-r--r-- | testsuite/tests/typing-unboxed-types/Makefile | 21 | ||||
-rw-r--r-- | testsuite/tests/typing-unboxed-types/ocamltests | 1 | ||||
-rw-r--r-- | testsuite/tests/typing-unboxed-types/test.ml | 9 | ||||
-rw-r--r-- | testsuite/tests/typing-unboxed-types/test.ml.reference-flat | 101 | ||||
-rw-r--r-- | testsuite/tests/typing-unboxed-types/test.ml.reference-noflat | 101 |
5 files changed, 110 insertions, 123 deletions
diff --git a/testsuite/tests/typing-unboxed-types/Makefile b/testsuite/tests/typing-unboxed-types/Makefile deleted file mode 100644 index e0a77e8430..0000000000 --- a/testsuite/tests/typing-unboxed-types/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -newdefault: test.ml.reference - @$(MAKE) default - -BASEDIR=../.. -include $(BASEDIR)/makefiles/Makefile.toplevel -include $(BASEDIR)/makefiles/Makefile.common - -GENERATED_SOURCES = test.ml.reference *.flat-float - -ifeq "$(FLAT_FLOAT_ARRAY)" "true" -suffix = -flat -else -suffix = -noflat -endif - -test.ml.reference: test.ml.reference$(suffix) $(FLAT_FLOAT_ARRAY).flat-float - @cp $< $@ - -%.flat-float: - @rm -f $(GENERATED_SOURCES) - @touch $@ diff --git a/testsuite/tests/typing-unboxed-types/ocamltests b/testsuite/tests/typing-unboxed-types/ocamltests new file mode 100644 index 0000000000..31c13b4431 --- /dev/null +++ b/testsuite/tests/typing-unboxed-types/ocamltests @@ -0,0 +1 @@ +test.ml diff --git a/testsuite/tests/typing-unboxed-types/test.ml b/testsuite/tests/typing-unboxed-types/test.ml index 06198c4ee7..25f03be289 100644 --- a/testsuite/tests/typing-unboxed-types/test.ml +++ b/testsuite/tests/typing-unboxed-types/test.ml @@ -1,3 +1,12 @@ +(* TEST + * flat-float-array + ** toplevel + compiler_reference = "${test_source_directory}/test.ml.reference-flat" + * no-flat-float-array + ** toplevel + compiler_reference = "${test_source_directory}/test.ml.reference-noflat" +*) + (* Check the unboxing *) (* For concrete types *) diff --git a/testsuite/tests/typing-unboxed-types/test.ml.reference-flat b/testsuite/tests/typing-unboxed-types/test.ml.reference-flat index 4bbf4b9eef..a9515e4d51 100644 --- a/testsuite/tests/typing-unboxed-types/test.ml.reference-flat +++ b/testsuite/tests/typing-unboxed-types/test.ml.reference-flat @@ -1,46 +1,45 @@ - -# type t1 = A of string [@@unboxed] -# - : bool = true -# type t2 = { f : string; } [@@unboxed] -# - : bool = true -# type t3 = B of { g : string; } [@@unboxed] -# - : bool = true -# Characters 29-58: +type t1 = A of string [@@unboxed] +- : bool = true +type t2 = { f : string; } [@@unboxed] +- : bool = true +type t3 = B of { g : string; } [@@unboxed] +- : bool = true +Characters 29-58: type t4 = C [@@ocaml.unboxed];; (* no argument *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because its constructor has no argument. -# Characters 0-45: +Characters 0-45: type t5 = D of int * string [@@ocaml.unboxed];; (* more than one argument *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because its constructor has more than one argument. -# Characters 0-33: +Characters 0-33: type t5 = E | F [@@ocaml.unboxed];; (* more than one constructor *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one constructor. -# Characters 0-40: +Characters 0-40: type t6 = G of int | H [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one constructor. -# Characters 0-51: +Characters 0-51: type t7 = I of string | J of bool [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one constructor. -# Characters 1-50: +Characters 1-50: type t8 = { h : bool; i : int } [@@ocaml.unboxed];; (* more than one field *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one field. -# Characters 0-56: +Characters 0-56: type t9 = K of { j : string; l : int } [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because its constructor has more than one argument. -# type t10 = A of t10 [@@unboxed] -# Characters 12-15: +type t10 = A of t10 [@@unboxed] +Characters 12-15: let rec x = A x;; ^^^ Error: This kind of expression is not allowed as right-hand side of `let rec' -# Characters 121-172: +Characters 121-172: ......struct type t = A of string [@@ocaml.unboxed] end.. @@ -55,7 +54,7 @@ Error: Signature mismatch: type t = A of string Their internal representations differ: the first declaration uses unboxed representation. -# Characters 63-96: +Characters 63-96: ......struct type t = A of string end.. @@ -70,7 +69,7 @@ Error: Signature mismatch: type t = A of string [@@unboxed] Their internal representations differ: the second declaration uses unboxed representation. -# Characters 48-102: +Characters 48-102: ......struct type t = { f : string } [@@ocaml.unboxed] end.. @@ -85,7 +84,7 @@ Error: Signature mismatch: type t = { f : string; } Their internal representations differ: the first declaration uses unboxed representation. -# Characters 66-102: +Characters 66-102: ......struct type t = { f : string } end.. @@ -100,7 +99,7 @@ Error: Signature mismatch: type t = { f : string; } [@@unboxed] Their internal representations differ: the second declaration uses unboxed representation. -# Characters 53-112: +Characters 53-112: ......struct type t = A of { f : string } [@@ocaml.unboxed] end.. @@ -115,7 +114,7 @@ Error: Signature mismatch: type t = A of { f : string; } Their internal representations differ: the first declaration uses unboxed representation. -# Characters 71-112: +Characters 71-112: ......struct type t = A of { f : string } end.. @@ -130,27 +129,27 @@ Error: Signature mismatch: type t = A of { f : string; } [@@unboxed] Their internal representations differ: the second declaration uses unboxed representation. -# type t11 = L of float [@@unboxed] -# - : unit = () -# type 'a t12 = M of 'a t12 [@@unboxed] -# val f : int t12 array -> int t12 = <fun> -# type t13 = A : 'a t12 -> t13 [@@unboxed] -# type t14 -# type t15 = A of t14 [@@unboxed] -# type 'a abs -# Characters 0-45: +type t11 = L of float [@@unboxed] +- : unit = () +type 'a t12 = M of 'a t12 [@@unboxed] +val f : int t12 array -> int t12 = <fun> +type t13 = A : 'a t12 -> t13 [@@unboxed] +type t14 +type t15 = A of t14 [@@unboxed] +type 'a abs +Characters 0-45: type t16 = A : _ abs -> t16 [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it might contain both float and non-float values. You should annotate it with [@@ocaml.boxed]. -# Characters 19-69: +Characters 19-69: type t18 = A : _ list abs -> t18 [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it might contain both float and non-float values. You should annotate it with [@@ocaml.boxed]. -# * Characters 176-256: +Characters 176-256: ......struct type t = A of float [@@ocaml.unboxed] type u = { f1 : t; f2 : t } @@ -163,51 +162,51 @@ Error: Signature mismatch: type u = { f1 : t; f2 : t; } Their internal representations differ: the first declaration uses unboxed float representation. -# * * module T : sig type t [@@immediate] end -# * type 'a s = S : 'a -> 'a s [@@unboxed] -# Characters 0-33: +module T : sig type t [@@immediate] end +type 'a s = S : 'a -> 'a s [@@unboxed] +Characters 0-33: type t = T : _ s -> t [@@unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it might contain both float and non-float values. You should annotate it with [@@ocaml.boxed]. -# type 'a s = S : 'a -> 'a option s [@@unboxed] -# Characters 0-33: +type 'a s = S : 'a -> 'a option s [@@unboxed] +Characters 0-33: type t = T : _ s -> t [@@unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it might contain both float and non-float values. You should annotate it with [@@ocaml.boxed]. -# module M : +module M : sig type 'a r constraint 'a = unit -> 'b val inj : 'b -> (unit -> 'b) r end -# Characters 14-59: +Characters 14-59: type t = T : (unit -> _) M.r -> t [@@unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it might contain both float and non-float values. You should annotate it with [@@ocaml.boxed]. -# type 'a s = S : (unit -> 'a) M.r -> 'a option s [@@unboxed] -# Characters 14-47: +type 'a s = S : (unit -> 'a) M.r -> 'a option s [@@unboxed] +Characters 14-47: type t = T : _ s -> t [@@unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it might contain both float and non-float values. You should annotate it with [@@ocaml.boxed]. -# type 'a t = T : 'a s -> 'a t [@@unboxed] -# Characters 42-81: +type 'a t = T : 'a s -> 'a t [@@unboxed] +Characters 42-81: type _ s = S : 'a t -> _ s [@@unboxed] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it might contain both float and non-float values. You should annotate it with [@@ocaml.boxed]. -# type 'a s +type 'a s type ('a, 'p) t = private 'a s type 'a packed = T : ('a, 'b) t -> 'a packed [@@unboxed] -# type f = { field : 'a. 'a list; } [@@unboxed] -# val g : f array = +type f = { field : 'a. 'a list; } [@@unboxed] +val g : f array = [|{field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}|] -# val h : f = {field = []} -# type 'a t [@@immediate] -# type u = U : 'a t -> u [@@unboxed] -# +val h : f = {field = []} +type 'a t [@@immediate] +type u = U : 'a t -> u [@@unboxed] + diff --git a/testsuite/tests/typing-unboxed-types/test.ml.reference-noflat b/testsuite/tests/typing-unboxed-types/test.ml.reference-noflat index 15a93542c7..49fd74e9be 100644 --- a/testsuite/tests/typing-unboxed-types/test.ml.reference-noflat +++ b/testsuite/tests/typing-unboxed-types/test.ml.reference-noflat @@ -1,46 +1,45 @@ - -# type t1 = A of string [@@unboxed] -# - : bool = true -# type t2 = { f : string; } [@@unboxed] -# - : bool = true -# type t3 = B of { g : string; } [@@unboxed] -# - : bool = true -# Characters 29-58: +type t1 = A of string [@@unboxed] +- : bool = true +type t2 = { f : string; } [@@unboxed] +- : bool = true +type t3 = B of { g : string; } [@@unboxed] +- : bool = true +Characters 29-58: type t4 = C [@@ocaml.unboxed];; (* no argument *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because its constructor has no argument. -# Characters 0-45: +Characters 0-45: type t5 = D of int * string [@@ocaml.unboxed];; (* more than one argument *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because its constructor has more than one argument. -# Characters 0-33: +Characters 0-33: type t5 = E | F [@@ocaml.unboxed];; (* more than one constructor *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one constructor. -# Characters 0-40: +Characters 0-40: type t6 = G of int | H [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one constructor. -# Characters 0-51: +Characters 0-51: type t7 = I of string | J of bool [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one constructor. -# Characters 1-50: +Characters 1-50: type t8 = { h : bool; i : int } [@@ocaml.unboxed];; (* more than one field *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because it has more than one field. -# Characters 0-56: +Characters 0-56: type t9 = K of { j : string; l : int } [@@ocaml.unboxed];; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This type cannot be unboxed because its constructor has more than one argument. -# type t10 = A of t10 [@@unboxed] -# Characters 12-15: +type t10 = A of t10 [@@unboxed] +Characters 12-15: let rec x = A x;; ^^^ Error: This kind of expression is not allowed as right-hand side of `let rec' -# Characters 121-172: +Characters 121-172: ......struct type t = A of string [@@ocaml.unboxed] end.. @@ -55,7 +54,7 @@ Error: Signature mismatch: type t = A of string Their internal representations differ: the first declaration uses unboxed representation. -# Characters 63-96: +Characters 63-96: ......struct type t = A of string end.. @@ -70,7 +69,7 @@ Error: Signature mismatch: type t = A of string [@@unboxed] Their internal representations differ: the second declaration uses unboxed representation. -# Characters 48-102: +Characters 48-102: ......struct type t = { f : string } [@@ocaml.unboxed] end.. @@ -85,7 +84,7 @@ Error: Signature mismatch: type t = { f : string; } Their internal representations differ: the first declaration uses unboxed representation. -# Characters 66-102: +Characters 66-102: ......struct type t = { f : string } end.. @@ -100,7 +99,7 @@ Error: Signature mismatch: type t = { f : string; } [@@unboxed] Their internal representations differ: the second declaration uses unboxed representation. -# Characters 53-112: +Characters 53-112: ......struct type t = A of { f : string } [@@ocaml.unboxed] end.. @@ -115,7 +114,7 @@ Error: Signature mismatch: type t = A of { f : string; } Their internal representations differ: the first declaration uses unboxed representation. -# Characters 71-112: +Characters 71-112: ......struct type t = A of { f : string } end.. @@ -130,17 +129,17 @@ Error: Signature mismatch: type t = A of { f : string; } [@@unboxed] Their internal representations differ: the second declaration uses unboxed representation. -# type t11 = L of float [@@unboxed] -# - : unit = () -# type 'a t12 = M of 'a t12 [@@unboxed] -# val f : int t12 array -> int t12 = <fun> -# type t13 = A : 'a t12 -> t13 [@@unboxed] -# type t14 -# type t15 = A of t14 [@@unboxed] -# type 'a abs -# type t16 = A : 'a abs -> t16 [@@unboxed] -# type t18 = A : 'a list abs -> t18 [@@unboxed] -# * Characters 176-256: +type t11 = L of float [@@unboxed] +- : unit = () +type 'a t12 = M of 'a t12 [@@unboxed] +val f : int t12 array -> int t12 = <fun> +type t13 = A : 'a t12 -> t13 [@@unboxed] +type t14 +type t15 = A of t14 [@@unboxed] +type 'a abs +type t16 = A : 'a abs -> t16 [@@unboxed] +type t18 = A : 'a list abs -> t18 [@@unboxed] +Characters 176-256: ......struct type t = A of float [@@ocaml.unboxed] type u = { f1 : t; f2 : t } @@ -153,27 +152,27 @@ Error: Signature mismatch: type u = { f1 : t; f2 : t; } Their internal representations differ: the first declaration uses unboxed float representation. -# * * module T : sig type t [@@immediate] end -# * type 'a s = S : 'a -> 'a s [@@unboxed] -# type t = T : 'a s -> t [@@unboxed] -# type 'a s = S : 'a -> 'a option s [@@unboxed] -# type t = T : 'a s -> t [@@unboxed] -# module M : +module T : sig type t [@@immediate] end +type 'a s = S : 'a -> 'a s [@@unboxed] +type t = T : 'a s -> t [@@unboxed] +type 'a s = S : 'a -> 'a option s [@@unboxed] +type t = T : 'a s -> t [@@unboxed] +module M : sig type 'a r constraint 'a = unit -> 'b val inj : 'b -> (unit -> 'b) r end -# type t = T : (unit -> 'a) M.r -> t [@@unboxed] -# type 'a s = S : (unit -> 'a) M.r -> 'a option s [@@unboxed] -# type t = T : 'a s -> t [@@unboxed] -# type 'a t = T : 'a s -> 'a t [@@unboxed] -# type _ s = S : 'a t -> 'b s [@@unboxed] +type t = T : (unit -> 'a) M.r -> t [@@unboxed] +type 'a s = S : (unit -> 'a) M.r -> 'a option s [@@unboxed] +type t = T : 'a s -> t [@@unboxed] +type 'a t = T : 'a s -> 'a t [@@unboxed] +type _ s = S : 'a t -> 'b s [@@unboxed] and _ t = T : 'a -> 'a s t -# type 'a s +type 'a s type ('a, 'p) t = private 'a s type 'a packed = T : ('a, 'b) t -> 'a packed [@@unboxed] -# type f = { field : 'a. 'a list; } [@@unboxed] -# val g : f array = +type f = { field : 'a. 'a list; } [@@unboxed] +val g : f array = [|{field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}; {field = []}|] -# val h : f = {field = []} -# type 'a t [@@immediate] -# type u = U : 'a t -> u [@@unboxed] -# +val h : f = {field = []} +type 'a t [@@immediate] +type u = U : 'a t -> u [@@unboxed] + |