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

Closed
vicuna opened this issue Apr 16, 2016 · 2 comments
Closed

Scrutinee discarded in match with only refutation cases #7230

vicuna opened this issue Apr 16, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@vicuna
Copy link

vicuna 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.

@vicuna
Copy link
Author

vicuna 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.

@vicuna
Copy link
Author

vicuna 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 as completed 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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants