Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005322OCamlOCaml generalpublic2011-07-28 11:182011-07-29 03:56
Reporterpoluxmoon 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.12.0 
Target VersionFixed in Version3.13.0+dev 
Summary0005322: Problem with forall and method
DescriptionType error on code similar to :

-----
type 'par t = 'par

let ident v = v

class alias =
object
  method alias : 'a . 'a t -> 'a = ident (* type error here *)
end
-----

Which gives :

-----
Error: This expression has type 'a. 'a t -> 'a
       but an expression was expected of type 'b. 'b t -> 'b
       Type 'a a = 'a is not compatible with type 'b t = 'b
-----
Additional InformationThe problem is related to unification of foralls containing named type in a method.
The compiler accepts equivalent code when not using the named type "t" or when not using a method (see attached file).
TagsNo tags attached.
Attached Files? file icon forallclass.ml [^] (300 bytes) 2011-07-28 11:18 [Show Content]

- Relationships

-  Notes
(0006066)
garrigue (manager)
2011-07-29 03:56

Thanks for your report.
Both Ctype.unify3 and Ctype.moregen didn't consider the possibility that a type abbreviation may expand to a universal type variable.
This is now fixed in both trunk and 3.12 branch (revision 11159).

- Issue History
Date Modified Username Field Change
2011-07-28 11:18 poluxmoon New Issue
2011-07-28 11:18 poluxmoon File Added: forallclass.ml
2011-07-29 03:56 garrigue Note Added: 0006066
2011-07-29 03:56 garrigue Status new => closed
2011-07-29 03:56 garrigue Resolution open => fixed
2011-07-29 03:56 garrigue Fixed in Version => 3.13.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker