-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix try region closure for "match with exception" under Flambda 2 (#1339
) Co-authored-by: Vincent Laviron <[email protected]>
- Loading branch information
Showing
3 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
ocaml/testsuite/tests/typing-local/match_with_exception.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(* TEST | ||
* native *) | ||
|
||
let[@inline never] f x = | ||
local_ (x, (0, 0)) | ||
|
||
let[@inline never] g x = | ||
local_ (x, 0) | ||
|
||
let[@inline never] h x = | ||
match f x with | ||
| exception Not_found -> 0 | ||
| p -> | ||
(* The try-region must not have been closed, otherwise [p2] will | ||
clobber [p] *) | ||
let p2 = g x in | ||
(fst (snd p)) + fst p2 | ||
|
||
let () = | ||
Printf.printf "%d\n" (h 0) |
1 change: 1 addition & 0 deletions
1
ocaml/testsuite/tests/typing-local/match_with_exception.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |