New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
program (mistakenly?) rejected due to nongeneralizable type variable that appears nowhere #5663
Comments
Comment author: @garrigue I'm not sure I understand your point here. |
Comment author: sweeks Sorry, my example had a mistake. Here is a much simpler example: module F (M : sig This causes the following error message: Error: The type of this module, The type variable that OCaml is complaining about, ['_a], is in the Adding a type constraint to [t] of the form [string M.t] isn't |
Comment author: @yallop With -short-paths the type variable doesn't even appear in the error message: $ ocamlc -short-paths pr5663.ml |
Comment author: @garrigue Added a patch which expands constructors while checking for non-generalizable variables. |
Comment author: @garrigue Fixed in trunk, at revision 16030, by expanding type abbreviations while checking for nongeneralizable type variables. |
Original bug ID: 5663
Reporter: sweeks
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-09-24T15:33:15Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.02.3+dev
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Bug description
The program below is rejected by the type checker.
module F (M : sig
type 'a v = string
include sig
type 'a t
type 'a u
val f : unit -> _ t
val g : 'a t -> 'a u -> unit
end with type 'a u := 'a v
end) = struct
open M
end
The error message is:
Error: The type of this module,
functor
(M : sig
type 'a v = string
type 'a t
val f : unit -> 'a t
val g : 'a t -> 'a v -> unit
end) ->
sig val t : '_a M.t end,
contains type variables that cannot be generalized
I think this program should be accepted. The type variable that OCaml
is complaining about is unused, if one expands out the types.
File attachments
The text was updated successfully, but these errors were encountered: