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
Odd behaviour of or-patterns with extensible typ #7661
Comments
Comment author: @thizanne Original report by Abdelraouf Ouadjaout. |
Comment author: @gasche By "odd behavior" you mean "major bug" ! Thanks for the report. |
Comment author: @gasche I could reproduce the bug with all versions of OCaml that support extensible datatypes, from 4.02.1 to 4.06.0+beta2. |
Comment author: @alainfrisch Could reproduce with exceptions as well, of course. |
Comment author: @gasche I pinged Luc (and Jacques) so hopefully they will look at it. Incidentially, I'm meeting Thomas and Luc tomorrow to discuss pattern-matching things, so I guess that must be put on our list. (Of course anyone with a fix before that is warmly welcome.) |
Comment author: @gasche To reproduce with exceptions, just replace
with
The correct lambda-code, from the state just before the faulty commit yallop found, looks like this: (setglobal Repro! The incorrect lambda-code (after this commit) looks like (setglobal Repro! |
Comment author: @gasche Fixed in trunk and the 4.06 maintenance branch. Thanks thizanne for the report! May I recommend that you find your next major bug during the development or beta-testing period, rather than during the release-candidate period? :-) |
Comment author: @hhugo Compiling jbuilder with trunk gives: Fatal error: exception Invalid_argument("index out of bounds") |
Comment author: @mshinwell Re-assigned to Luc for fixing. |
Comment author: @hhugo instructions to reproduce the issue: opam switch 4.07.0+trunk |
Original bug ID: 7661
Reporter: @thizanne
Assigned to: @maranget
Status: resolved (set by @trefis on 2018-01-09T11:56:53Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.05.0
Fixed in version: 4.06.1+dev/rc1/rc2
Category: middle end (typedtree to clambda)
Related to: #5788
Monitored by: @gasche
Bug description
On this example, the evaluation of
f A B
doesn't go in the(A | B) , B
branch. It works as intended ift
is a non-extensible sum type. If the two first lines of the pattern matching are inverted, thena
has the unexpected'_'
value.The text was updated successfully, but these errors were encountered: