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: 5224 Reporter: furuse Assigned to:@garrigue Status: closed (set by @garrigue on 2012-06-01T05:13:21Z) Resolution: fixed Priority: normal Severity: minor Version: 3.11.2 Fixed in version: 4.00.0+dev Category: ~DO NOT USE (was: OCaml general)
Bug description
type 'x t = < f : 'y. 'y t >
gives me an error. I do not understand why this is rejected, but the reason is not the issue. The problem is the error message:
Error: In the definition of t, type 'a t should be 'b t
This should be printed as type 'y t should be 'x t .
The text was updated successfully, but these errors were encountered:
This is rejected because this type is non-regular, i.e. it is a parameterized structural type where which is instanciated with a different type parameter.
This is also the reason why the code snippet below is rejected:
type 'a foo = [A | B of ('a foo) foo];;
Error: In the definition of foo, type 'a foo foo should be 'a foo
The solution is to define an intermediary nominal type:
type 'a tmp = T of 'a t
Then:
type 'x t = < f : 'y. 'y tmp >
Of course you need these two types to be mutually recursive.
type 'a tmp = Tmp of 'a t and 'a t = < f: 'y. 'y tmp >;;
type 'a tmp = Tmp of 'a t
and 'a t = < f : 'y. 'y tmp >
Original bug ID: 5224
Reporter: furuse
Assigned to: @garrigue
Status: closed (set by @garrigue on 2012-06-01T05:13:21Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.2
Fixed in version: 4.00.0+dev
Category: ~DO NOT USE (was: OCaml general)
Bug description
type 'x t = < f : 'y. 'y t >
gives me an error. I do not understand why this is rejected, but the reason is not the issue. The problem is the error message:
Error: In the definition of t, type 'a t should be 'b t
This should be printed as type 'y t should be 'x t .
The text was updated successfully, but these errors were encountered: