Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Dec 20, 2021
1 parent 02ae2a3 commit 4634ef0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions testsuite/tests/tool-toplevel/pr10712.compilers.reference
@@ -0,0 +1,5 @@
module A :
sig type ('foo, 'bar) t val get_foo : ('foo, 'a) t -> 'foo option end
- : ('foo, 'a) A.t -> 'foo option = <fun>
val _bar : ('a, 'b) A.t -> 'a option = <fun>

27 changes: 27 additions & 0 deletions testsuite/tests/tool-toplevel/pr10712.ml
@@ -0,0 +1,27 @@
(* TEST
* toplevel
* toplevel.opt
*)

module A : sig
type ('foo, 'bar) t

val get_foo : ('foo, _) t -> 'foo option
end = struct
type ('foo, 'bar) t =
| Foo of 'foo
| Bar of 'bar

let get_foo = function
| Foo foo -> Some foo
| Bar _ -> None
end
;;

(* Type variables should be 'foo and 'a (name persists) *)
A.get_foo
;;

(* Type variables be 'a and 'b (original names lost in let-binding) *)
let _bar = A.get_foo
;;

0 comments on commit 4634ef0

Please sign in to comment.