Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007894OCamltypingpublic2019-01-09 07:282019-01-10 15:00
Reporterwlitwin 
Assigned Totrefis 
PrioritynormalSeveritycrashReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version4.07.0 
Target VersionFixed in Version 
Summary0007894: Fatal error: exception File "typing/typeclass.ml", line 294
DescriptionOCaml 4.07.0 fails to compile the following program:

class basicWidget app = object(self)
    method invalidate : unit =
        app#redrawWidget self
end

class simple app =
    let label1 = new basicWidget app in
object(self)
    inherit basicWidget app
end

let _ = new simple (object end)
Steps To Reproducepaste the description code into a src file and try building with:

ocamlc file.ml

The following happens:

Fatal error: exception File "typing/typeclass.ml", line 294, characters 12-18: Assertion failed
TagsNo tags attached.
Attached Files? file icon main.ml [^] (240 bytes) 2019-01-09 07:28 [Show Content]

- Relationships

-  Notes
(0019535)
wlitwin (reporter)
2019-01-09 08:09

Forgot to check trunk, still appears to throw an exception as of commit:

711362988734ea03b81c4ac9a32e07133572bc08
Date: Tue Jan 8 17:20:42 2019 +0100

$ ./ocamlc --version
4.08.0+dev0-2018-04-09

$ ./ocamlc main.ml
Fatal error: exception File "typing/typeclass.ml", line 302, characters 15-21: Assertion failed
(0019536)
gasche (administrator)
2019-01-09 09:50

This appears to be a regression in 4.07.0. Indeed, 4.06.1 prints the following message instead:

File "test.ml", line 10, characters 24-27:
Error: This expression has type < redrawWidget : basicWidget -> unit; .. >
       but an expression was expected of type
         < redrawWidget : (< invalidate : unit; .. > as 'a) -> unit; .. >
       Type basicWidget = < invalidate : unit > is not compatible with type
         < invalidate : unit; .. > as 'a
       Self type cannot be unified with a closed object type
(0019537)
gasche (administrator)
2019-01-09 11:12

I traced the regression back to this commit

  "make the dummy method disappear when finalizing a class"
  86e1c8a4e0cd8f52cd3ebdf57e8776ca79235c02
  https://github.com/ocaml/ocaml/commit/86e1c8a4e0cd8f52cd3ebdf57e8776ca79235c02 [^]
(0019544)
trefis (manager)
2019-01-10 15:00

We looked at this yesterday with Leo, and found a couple of other related issues.
Leo is currently working on a fix. (details to follow in a GPR)

- Issue History
Date Modified Username Field Change
2019-01-09 07:28 wlitwin New Issue
2019-01-09 07:28 wlitwin File Added: main.ml
2019-01-09 08:09 wlitwin Note Added: 0019535
2019-01-09 09:50 gasche Note Added: 0019536
2019-01-09 11:12 gasche Note Added: 0019537
2019-01-09 11:12 gasche Assigned To => trefis
2019-01-09 11:12 gasche Status new => confirmed
2019-01-10 15:00 trefis Note Added: 0019544


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker