You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4850 Reporter:@alainfrisch Status: acknowledged (set by @xavierleroy on 2012-08-06T16:25:08Z) Resolution: open Priority: normal Severity: feature Version: 3.11.1 Target version: later Category: typing Tags: recmod Monitored by:@jberdine "Julien Signoles"
Bug description
The following code is accepted by the type-checker:
module X: sig
type 'a t
val f: int t -> unit t
end = struct
type 'a t = {x: int}
let f x = (x : int t :> unit t)
end
If one turns it into a recursive module, the type-checkers complains with:
Error: Type int t = int X.t is not a subtype of unit t = unit X.t
The problem comes from:
Ctype.subtype_rec expands abbreviations of type constructors with arity > 0.
The typing of recursive modules introduces extra type manifests to type declarations (cf "anchor" in Typemod).
I guess the problem could occur with explicit type manifest as well, but in that case the user is in control of it. I'm unsure about the correct behavior of subtyping w.r.t. type abbreviation, but I'd clearly prefer it if turning a non-recursive module definition into a recursive did not not break type-checking.
Does restricting expansion to cases where the manifest is explicitly given by the programmer seem reasonable?
The text was updated successfully, but these errors were encountered:
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
Original bug ID: 4850
Reporter: @alainfrisch
Status: acknowledged (set by @xavierleroy on 2012-08-06T16:25:08Z)
Resolution: open
Priority: normal
Severity: feature
Version: 3.11.1
Target version: later
Category: typing
Tags: recmod
Monitored by: @jberdine "Julien Signoles"
Bug description
The following code is accepted by the type-checker:
module X: sig
type 'a t
val f: int t -> unit t
end = struct
type 'a t = {x: int}
let f x = (x : int t :> unit t)
end
If one turns it into a recursive module, the type-checkers complains with:
Error: Type int t = int X.t is not a subtype of unit t = unit X.t
The problem comes from:
I guess the problem could occur with explicit type manifest as well, but in that case the user is in control of it. I'm unsure about the correct behavior of subtyping w.r.t. type abbreviation, but I'd clearly prefer it if turning a non-recursive module definition into a recursive did not not break type-checking.
Does restricting expansion to cases where the manifest is explicitly given by the programmer seem reasonable?
The text was updated successfully, but these errors were encountered: