Skip to content

Commit

Permalink
Promote tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liam923 committed Jan 31, 2025
1 parent 3d084c9 commit ee61b4c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 41 deletions.
82 changes: 42 additions & 40 deletions testsuite/tests/typing-jkind-bounds/subsumption/fuel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,108 +10,110 @@ type 'a my_list = 'a list = [] | ( :: ) of 'a * 'a my_list
places. The below types are chosen so that they are equal, but fuel runs out in
different places. If fuel is changed, they should be modified so that this continues
to be true, and all instances of them in this file should also be updated. *)
type t : immutable_data = int list my_list list list
type t : immutable_data = int list my_list list my_list list
[%%expect {|
type 'a my_list = 'a list = [] | (::) of 'a * 'a my_list
type t = int list my_list list list
type t = int list my_list list my_list list
|}]
type t : immutable_data = int list list list list
type t : immutable_data = int list list list list list list
[%%expect {|
Line 1, characters 0-49:
1 | type t : immutable_data = int list list list list
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The kind of type "int list list list list" is immutable_data
with int list list list
Line 1, characters 0-59:
1 | type t : immutable_data = int list list list list list list
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The kind of type "int list list list list list list" is immutable_data
with int list list list list list
because it's a boxed variant type.
But the kind of type "int list list list list" must be a subkind of
But the kind of type "int list list list list list list" must be a subkind of
immutable_data
because of the definition of t at line 1, characters 0-49.
because of the definition of t at line 1, characters 0-59.
|}]

(* Differences in fuel consumption do not cause errors for module inclusion check
when both types have manifests *)
module M : sig
type t = int list my_list list list
type t = int list my_list list my_list list
end = struct
type t = int list list list list
type t = int list list list list list
end
[%%expect{|
module M : sig type t = int list my_list list list end
module M : sig type t = int list my_list list my_list list end
|}]

(* Differences in fuel consumption do not cause errors for module inclusion check
when both types have kinds *)
module M : sig
type t = Foo of int list my_list list list
type t = Foo of int list my_list list my_list list
end = struct
type t = Foo of int list list list list
type t = Foo of int list list list list list
end
[%%expect{|
module M : sig type t = Foo of int list my_list list list end
module M : sig type t = Foo of int list my_list list my_list list end
|}]

(* Differences in fuel consumption do not cause errors for module inclusion check
when both types have kinds and manifests *)
type foo = Foo of int list my_list list list
type foo = Foo of int list my_list list my_list list
module M : sig
type t = foo = Foo of int list my_list list list
type t = foo = Foo of int list my_list list my_list list
end = struct
type t = foo = Foo of int list list list list
type t = foo = Foo of int list list list list list
end
[%%expect{|
type foo = Foo of int list my_list list list
module M : sig type t = foo = Foo of int list my_list list list end
type foo = Foo of int list my_list list my_list list
module M : sig type t = foo = Foo of int list my_list list my_list list end
|}]

type foo = Foo of int list list list list
type foo = Foo of int list list list list list
module M : sig
type t = foo = Foo of int list my_list list list
type t = foo = Foo of int list my_list list my_list list
end = struct
type t = foo = Foo of int list list list list
type t = foo = Foo of int list list list list list
end
[%%expect{|
type foo = Foo of int list list list list
module M : sig type t = foo = Foo of int list my_list list list end
type foo = Foo of int list list list list list
module M : sig type t = foo = Foo of int list my_list list my_list list end
|}]

(* Differences in fuel consumption do not cause errors when both a type has both kind and
manifest *)
type foo1 = Foo of int list my_list list list
type foo2 = foo1 = Foo of int list list list list
type foo1 = Foo of int list my_list list my_list list
type foo2 = foo1 = Foo of int list list list list list
[%%expect{|
type foo1 = Foo of int list my_list list list
type foo2 = foo1 = Foo of int list list list list
type foo1 = Foo of int list my_list list my_list list
type foo2 = foo1 = Foo of int list list list list list
|}]

type foo1 = Foo of int list list list list
type foo2 = foo1 = Foo of int list my_list list list
type foo1 = Foo of int list list list list list
type foo2 = foo1 = Foo of int list my_list list my_list list
[%%expect{|
type foo1 = Foo of int list list list list
type foo2 = foo1 = Foo of int list my_list list list
type foo1 = Foo of int list list list list list
type foo2 = foo1 = Foo of int list my_list list my_list list
|}]

(* Differences in fuel consumption do not cause errors when satisfying a functor
constraint *)
module F (M : sig
type t = Foo of int list my_list list list
type t = Foo of int list my_list list my_list list
end) = struct end
module M = F (struct
type t = Foo of int list list list list
type t = Foo of int list list list list list
end)
[%%expect {|
module F :
functor (M : sig type t = Foo of int list my_list list list end) -> sig end
functor (M : sig type t = Foo of int list my_list list my_list list end) ->
sig end
module M : sig end
|}]

module F (M : sig
type t = int list my_list list list
type t = int list my_list list my_list list
end) = struct end
module M = F (struct
type t = int list list list list
type t = int list list list list list
end)
[%%expect {|
module F :
functor (M : sig type t = int list my_list list list end) -> sig end
functor (M : sig type t = int list my_list list my_list list end) ->
sig end
module M : sig end
|}]
5 changes: 4 additions & 1 deletion testsuite/tests/typing-jkind-bounds/subsumption/recursive.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ Line 1, characters 0-89:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The kind of type "degenerate" is immutable_data with 'a with 'a * 'a
with ('a * 'a) * ('a * 'a)
with ((('a * 'a) * ('a * 'a)) * (('a * 'a) * ('a * 'a))) degenerate
with (('a * 'a) * ('a * 'a)) * (('a * 'a) * ('a * 'a))
with (((('a * 'a) * ('a * 'a)) * (('a * 'a) * ('a * 'a))) *
((('a * 'a) * ('a * 'a)) * (('a * 'a) * ('a * 'a))))
degenerate
because it's a boxed variant type.
But the kind of type "degenerate" must be a subkind of immutable_data
with 'a
Expand Down

0 comments on commit ee61b4c

Please sign in to comment.