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
type inference for inheritance is broken in OCaml 4.07 #7865
Comments
Comment author: @trefis I could indeed reproduce on 4.07 but neither on previous versions, nor on trunk. Note that one needs to pattern-match on a variant type to be able to get the error message on 4.07, if one uses an other construct (e.g. an if) or matches on a string, everything works fine. It seems that #1735 ( #1735 ) fixed the issue, at least for the small reproduction case available on this MPR. I haven't looked into the details of what was going wrong and how this change could have fixed it yet however. The uncaught exception that you mention looks like it might be yet another issue, and I will try to look into it further in a couple of days. |
Comment author: frank-emrich Just to confirm that the compiler exception we were seeing in the context of this bug has been resolved in trunk, too. |
Fair point, I'm reopening until this is done. |
Check that the bogus "Self type cannot escape its class" error that appeared in 4.07.0 does not recur.
Original bug ID: 7865
Reporter: slindley
Assigned to: @trefis
Status: assigned (set by @trefis on 2018-10-22T13:04:17Z)
Resolution: open
Priority: high
Severity: major
Version: 4.07.0
Category: typing
Monitored by: @nojb @hcarty
Bug description
Attempting to compile the following code
leads to the error
The problem can be worked around by adding type annotations:
Additional information
In the context of a much larger program (the Links web programming language), we managed to make the compiler crash (even with the type annotation) by invoking another method in the body of the match:
links-lang/links#407
It probably wouldn't be too hard to generate a small example for that bug too, but I'm hopeful that fixing the initial typing problem may also fix the compiler crash.
The text was updated successfully, but these errors were encountered: