Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006320OCamlOCaml typingpublic2014-02-05 18:352014-02-06 16:06
Reporterpw374 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version4.01.0 
Target VersionFixed in Version 
Summary0006320: type 'a x = [> ] as 'a and 'a t = { z : 'a x } doesn't compile
Descriptiontype '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 Reproduce1. Compile a file that only has
type 'a x = [> ] as 'a
type 'a t = { z : 'a x }

2. Compile a file that only has
type 'a x = [> ] as 'a
and 'a t = { z : 'a x }
Additional InformationThe error message is:

Error: Constraints are not satisfied in this type.
       Type 'a x should be an instance of [> ] x
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0010889)
garrigue (manager)
2014-02-06 01:33

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 }
(0010903)
pw374 (reporter)
2014-02-06 16:06

Ok, thanks.

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...

- Issue History
Date Modified Username Field Change
2014-02-05 18:35 pw374 New Issue
2014-02-06 01:33 garrigue Note Added: 0010889
2014-02-06 01:33 garrigue Status new => resolved
2014-02-06 01:33 garrigue Resolution open => no change required
2014-02-06 01:33 garrigue Assigned To => garrigue
2014-02-06 16:06 pw374 Note Added: 0010903


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker