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: 6320 Reporter: pw374 Assigned to:@garrigue Status: closed (set by @xavierleroy on 2015-12-11T18:25:40Z) Resolution: not a bug Priority: normal Severity: minor Version: 4.01.0 Category: typing
Bug description
type 'a x = [> ] as 'a
type 'a t = { z : 'a x }
compiles just fine but
type 'a x = [> ] as 'a
and 'a t = { z : 'a x }
doesn't.
I'm not sure that it's a bug but if it's not, I really don't see why and I'd love some explanations.
Cheers.
Steps to reproduce
Compile a file that only has
type 'a x = [> ] as 'a
type 'a t = { z : 'a x }
Compile a file that only has
type 'a x = [> ] as 'a
and 'a t = { z : 'a x }
Additional information
The error message is:
Error: Constraints are not satisfied in this type.
Type 'a x should be an instance of [> ] x
The text was updated successfully, but these errors were encountered:
When a type abbreviation has a constraint, it is not propagated automatically to mutually recursive types.
This is to allow type abbreviations to be used polymorphically inside the recursion.
As a result you must propagate the constraint by hand:
type 'a x = [> ] as 'a
and 'a t = { z : ([> ] as 'a) x }
However it's quite inconvenient if instead of just [> ] we have a rather big sum [> Int of int | String of string | ...etc... ], since we'd have to repeat that big sum as many times at it's used by different types...
Original bug ID: 6320
Reporter: pw374
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:25:40Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 4.01.0
Category: typing
Bug description
type 'a x = [> ] as 'a
type 'a t = { z : 'a x }
compiles just fine but
type 'a x = [> ] as 'a
and 'a t = { z : 'a x }
doesn't.
I'm not sure that it's a bug but if it's not, I really don't see why and I'd love some explanations.
Cheers.
Steps to reproduce
Compile a file that only has
type 'a x = [> ] as 'a
type 'a t = { z : 'a x }
Compile a file that only has
type 'a x = [> ] as 'a
and 'a t = { z : 'a x }
Additional information
The error message is:
Error: Constraints are not satisfied in this type.
Type 'a x should be an instance of [> ] x
The text was updated successfully, but these errors were encountered: