Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
type inference for inheritance is broken in OCaml 4.07 #7865
Original bug ID: 7865
Attempting to compile the following code
leads to the error
The problem can be worked around by adding type annotations:
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:
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.
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.