Skip to content

Commit

Permalink
Add regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lpw25 committed Mar 21, 2020
1 parent 466ed63 commit 2e08e99
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions testsuite/tests/typing-modules/pr9384.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(* TEST
* expect
*)

module M : sig
type 'a t := [< `A ] as 'a
val f : 'a -> 'a t
end = struct
let f x = x
end;;
[%%expect{|
Lines 4-6, characters 6-3:
4 | ......struct
5 | let f x = x
6 | end..
Error: Signature mismatch:
Modules do not match:
sig val f : 'a -> 'a end
is not included in
sig val f : [< `A ] -> [< `A ] end
Values do not match:
val f : 'a -> 'a
is not included in
val f : [< `A ] -> [< `A ]
|}]

type foo = { foo : 'a. ([< `A] as 'a) -> 'a }

module Foo (X : sig type 'a t := [< `A ] as 'a type foo2 = foo = { foo : 'a. 'a t -> 'a t } end) = struct
let f { X.foo } = foo
end;;
[%%expect{|
type foo = { foo : 'a. ([< `A ] as 'a) -> 'a; }
Uncaught exception: File "typing/ctype.ml", line 1441, characters 11-17: Assertion failed

|}]

type bar = { bar : 'a. ([< `A] as 'a) -> 'a }

module Bar (X : sig type 'a t := 'a type bar2 = bar = { bar : 'a. ([< `A] as 'a) t -> 'a t } end) = struct
let f { X.bar } = bar
end;;
[%%expect{|
type bar = { bar : 'a. ([< `A ] as 'a) -> 'a; }
Uncaught exception: File "typing/ctype.ml", line 1441, characters 11-17: Assertion failed

|}]

0 comments on commit 2e08e99

Please sign in to comment.