Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004766OCamlOCaml generalpublic2009-04-09 16:122009-04-10 08:33
Reporterpveber 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.11.1+dev 
Summary0004766: Incorrect type inference with objects
DescriptionConsider the following session with ocaml 3.11 interpreter :

        Objective Caml version 3.11.0

# class virtual ['a] c =
object (s : 'a)
  method virtual m : 'b
end
;;
class virtual ['a] c :
  object ('a) constraint 'a = < m : 'b; .. > method virtual m : 'b end
# let o =
    object (s :'a)
      inherit ['a] c
      method m = 42
    end;;
val o : 'a c as 'a = ...
# o#m;;
- : 'a = <poly>

It seems that the typing of instance o is incorrect, and should rather be something like 'a c as 'a constraint 'a = < m : int; .. >. I did not find any previous report of this problem. The behaviour is the same on ocaml 3.10.2.

BTW: thanks for your excellent work on ocaml, and all the very instructive messages sent by the caml dev team on caml-list.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004920)
garrigue (manager)
2009-04-10 08:33

The real problem was in the way abbreviations were simplified in
Ctype.normalize_type.
Concretely, ('a c as 'a) does not accurately define a type, since it can describe any instance of itself too...

- Issue History
Date Modified Username Field Change
2009-04-09 16:12 pveber New Issue
2009-04-10 08:33 garrigue Note Added: 0004920
2009-04-10 08:33 garrigue Status new => closed
2009-04-10 08:33 garrigue Resolution open => fixed
2009-04-10 08:33 garrigue Fixed in Version => 3.11.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker