forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|}] |