-
Notifications
You must be signed in to change notification settings - Fork 1.2k
module typing bug? #2696
Description
Original bug ID: 299
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Related to: #5984
Bug description
Here's an example of a .ml and .mli file (the original .mli generated
by ocamlc -i -c) that cause a compilation failure in 3.00+22 but are fine
in 3.00. I did a fair bit of snipping but I can show the original code if
it's helpful
(* polyset.mli *)
module type OrderedType = sig type 'a t val compare : 'a t -> 'a t -> int end
module ClassicalType :
sig
type 'a t = 'a
val compare : 'a -> 'a -> int
end
module type S =
sig
type 'a elt
and 'a t
val empty : 'a t
val is_empty : 'a t -> bool
end
module Make(Ord : OrderedType) : (S with type 'a elt = 'a Ord.t)
module Set :
sig
type 'a elt = 'a
and 'a t =
Empty
| Node of 'a t * 'a elt * 'a t * int
val empty : 'a t
val is_empty : 'a t -> bool
end
(* polyset.ml *)
module type OrderedType =
sig
type 'a t
val compare: 'a t -> 'a t -> int
end
module ClassicalType =
struct
type 'a t = 'a
let compare = Pervasives.compare
end
module type S =
sig
type 'a elt
type 'a t
val empty : 'a t
val is_empty : 'a t -> bool
end
module Make (Ord : OrderedType) : (S with type 'a elt = 'a Ord.t) =
struct
type 'a elt = 'a Ord.t
type 'a t = Empty | Node of 'a t * 'a elt * 'a t * int
let empty = Empty
let is_empty = function Empty -> true | _ -> false
end
module Set = Make(ClassicalType)
ocamlc -c polyset.ml
The implementation polyset.ml does not match the interface polyset.cmi:
Modules do not match:
sig
type 'a elt = 'a ClassicalType.t
and 'a t = 'a Make(ClassicalType).t
val empty : 'a t
val is_empty : 'a t -> bool
end
is not included in
sig
type 'a elt = 'a
and 'a t = Empty | Node of 'a t * 'a elt * 'a t * int
val empty : 'a t
val is_empty : 'a t -> bool
end
Type declarations do not match:
type 'a elt = 'a ClassicalType.t
is not included in
type 'a elt = 'a
-- Brian