Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005224OCamlOCaml generalpublic2011-02-14 10:062012-06-01 07:13
Reporterfuruse 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.2 
Target VersionFixed in Version4.00.0+dev 
Summary0005224: Confusing error message at object type definition
Descriptiontype '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 .
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0007481)
protz (manager)
2012-05-31 13:57

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 >
(0007492)
garrigue (manager)
2012-06-01 07:13

Fixed in trunk and 4.00, revisions 12533 and 12534.

- Issue History
Date Modified Username Field Change
2011-02-14 10:06 furuse New Issue
2011-05-17 16:16 doligez Status new => acknowledged
2012-05-31 11:21 frisch Severity major => minor
2012-05-31 13:57 protz Note Added: 0007481
2012-06-01 07:13 garrigue Note Added: 0007492
2012-06-01 07:13 garrigue Status acknowledged => closed
2012-06-01 07:13 garrigue Assigned To => garrigue
2012-06-01 07:13 garrigue Resolution open => fixed
2012-06-01 07:13 garrigue Fixed in Version => 4.00.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker