Skip to content

Exception rebinding breaks pattern matching #5788

@vicuna

Description

@vicuna

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions