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

Scrutinee discarded in match with only refutation cases #7230

vicuna opened this issue Apr 16, 2016 · 2 comments


None yet
2 participants
Copy link

commented Apr 16, 2016

Original bug ID: 7230
Reporter: @yallop
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-09-24T15:32:25Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.03.0+dev / +beta1
Target version: 4.03.1+dev
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: runhang @stedolan @gasche @hcarty

Bug description

The following program raises Match_error:

type _ t = T : int t
let _ = match (raise Not_found : float t) with _ -> .

I think it should instead raise Not_found.

More generally, the code of the scrutinee is entirely discarded when a match has only refutation cases, but it should be retained and executed, even though the match itself is guaranteed to fail.


This comment has been minimized.

Copy link

commented Apr 18, 2016

Comment author: @garrigue

This looks like a question for Luc: the pattern-matching compiler does a lot of optimizations, so it is not so clear what should be done to disable this one only in this precise case.


This comment has been minimized.

Copy link

commented Apr 22, 2016

Comment author: @garrigue

Fixed in 4.03 and trunk by commits 09bda47 and 40796a2.

Do not close it yet because I would like Luc to check it.

@vicuna vicuna closed this Sep 24, 2017

@vicuna vicuna added this to the 4.03.1 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

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.