Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006496OCamlOCaml typingpublic2014-07-23 18:322014-08-21 08:19
Reporterchoeger 
Assigned Togarrigue 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionduplicate 
Platformx86OSLinuxOS Version3.15.4
Product Version4.01.0 
Target Version4.02.1+devFixed in Version 
Summary0006496: Assertion triggered by recursive class type
DescriptionThe following class type leads to a hard crash of the typechecker:

type 'r foo_t = <get : 'r bar option ; set : 'r bar option -> 'r; ..> as 'r

and 'r bar
constraint 'r = 'r foo_t

class c : object('r)
  constraint 'r = 'r foo_t
  method get : 'r bar option
  method set : 'r bar option -> 'r
end = object(self: 'r)
  constraint 'r = 'r foo_t
  val _bar : 'r bar option = None
  method get = _bar
  method set b = {< _bar = b >}
end
Steps To ReproduceEither run ocamlc on the above interface:

ocamlc -o test.cmi test.mli

or #use the following implementation in a toplevel:

type 'r foo_t = <get : 'r bar option ; set : 'r bar option -> 'r; ..> as 'r

and 'r bar
constraint 'r = 'r foo_t

class c : object('r)
  constraint 'r = 'r foo_t
  method get : 'r bar option
  method set : 'r bar option -> 'r
end = object(self: 'r)
  constraint 'r = 'r foo_t
  val _bar : 'r bar option = None
  method get = _bar
  method set b = {< _bar = b >}
end
Additional InformationIn any case, the crash is:

Fatal error: exception Assert_failure("typing/ctype.ml", 245, 27)
TagsNo tags attached.
Attached Files

- Relationships
child of 0006505resolvedgarrigue Missed Type-error leads to a segfault upon record access 

-  Notes
(0011903)
lpw25 (developer)
2014-07-23 19:56

Smaller example:

    type 'r foo = 'r constraint 'r = <m : 'r bar; ..>
    and 'r bar constraint 'r = 'r foo

    class type c = object('r)
      method m : 'r bar
    end
(0011951)
doligez (administrator)
2014-07-30 23:14

Downgrading this to "major" because it's only a compiler failure, not a crash of the user program.
(0012034)
garrigue (manager)
2014-08-21 08:19

The source of the problem is the same as PR#6505, and it is already fixed in 4.02.

- Issue History
Date Modified Username Field Change
2014-07-23 18:32 choeger New Issue
2014-07-23 19:56 lpw25 Note Added: 0011903
2014-07-30 23:14 doligez Note Added: 0011951
2014-07-30 23:14 doligez Severity crash => major
2014-07-30 23:14 doligez Status new => acknowledged
2014-08-20 14:31 doligez Target Version => 4.02.1+dev
2014-08-21 08:17 garrigue Relationship added child of 0006505
2014-08-21 08:19 garrigue Note Added: 0012034
2014-08-21 08:19 garrigue Status acknowledged => resolved
2014-08-21 08:19 garrigue Resolution open => duplicate
2014-08-21 08:19 garrigue Assigned To => garrigue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker