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

Exception rebinding breaks pattern matching #5788

Closed
vicuna opened this issue Oct 12, 2012 · 3 comments
Closed

Exception rebinding breaks pattern matching #5788

vicuna opened this issue Oct 12, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@vicuna
Copy link

vicuna commented Oct 12, 2012

Original bug ID: 5788
Reporter: @lpw25
Assigned to: @maranget
Status: closed (set by @xavierleroy on 2015-12-11T18:25:25Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.00.0
Target version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #7661
Monitored by: @hcarty @alainfrisch

Bug description

It seems that pattern matching does not allow for the possibility of exceptions being rebound.

This can be demonstrated with the following code:

# exception Foo;;
exception Foo
# exception Bar = Foo;;
exception Bar
# let test e b =
    match e, b with
      Foo, true -> 1
    | Bar, false -> 2
    | _, _ -> 3;;
val test : exn -> bool -> int = <fun>
# test Bar false;;
- : int = 3
@vicuna
Copy link
Author

vicuna commented Jun 7, 2013

Comment author: @maranget

Nice trick
--Luc

@vicuna
Copy link
Author

vicuna commented Jun 14, 2013

Comment author: @alainfrisch

I mark this issue as major (mis-compilation).

@vicuna
Copy link
Author

vicuna commented Jul 2, 2013

Comment author: @maranget

I have just commited a tentative patch in trunk.
--Luc

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