Closed elpinal closed 5 years ago
In contrast, the following, a bit modified version is considered well-typed by the typechecker.
@require: stdjareport
module M : sig
type t
type s
val f : s -> t list
end = struct
type t = int
type s = t list
let f x =
let _ = List.length x in % The addition of this line makes typechecking succeed!
x
end in
StdJaReport.document (|
title = {};
author = {};
|) '<
>
Since this second example is well-typed, the first example also should be well-typed. So I believe this is a bug.
Description
It turns out that the typechecker cannot equate two abstract types when defining a module which defines the abstract types.
How to reproduce
test.saty
:Then, execute
satysfi
:In this situation,
M.s
andM.t list
should be deemed equivalent; It is outsideM
that they should be considered incompatible. So typechecking the example should pass.Moreover, the above module definition is well-typed in both OCaml and Standard ML.