Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: exception File "typing/typeclass.ml", line 294 #7894

Open
vicuna opened this Issue Jan 9, 2019 · 6 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Jan 9, 2019

Original bug ID: 7894
Reporter: wlitwin
Assigned to: @lpw25
Status: assigned (set by @lpw25 on 2019-02-15T10:13:47Z)
Resolution: open
Priority: normal
Severity: crash
Version: 4.07.0
Category: typing
Monitored by: @nojb @gasche

Bug description

OCaml 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 reproduce

paste 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

File attachments

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 9, 2019

Comment author: wlitwin

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

7113629
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

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 9, 2019

Comment author: @gasche

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

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 9, 2019

Comment author: @gasche

I traced the regression back to this commit

"make the dummy method disappear when finalizing a class"
86e1c8a
86e1c8a

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 10, 2019

Comment author: @trefis

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)

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 19, 2019

Comment author: @garrigue

Is there any progress on this one?
Interactions in the object system are subtle, as this problem has demonstrated.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 19, 2019

Comment author: @lpw25

I've got a patch coming that tidies up a fair few things in typeclass.ml and fixes this bug. Should take me a few more days, so assuming no urgent interruptions I should make a PR this week or next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.