summaryrefslogtreecommitdiff
path: root/testsuite/tests/match-exception-warnings/no_mixing_under_guard.ml
blob: 225d53054d5ab5d5be64c674b3ddf8d3ed2077c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(* TEST
   * expect
*)
exception Exit

let r = ref ""

let guarded f =
  match f () with
  | true | exception Exit when r := "hello"; true -> !r
  | _ -> "other"
;;

[%%expect{|
exception Exit
val r : string ref = {contents = ""}
Line 7, characters 4-25:
7 |   | true | exception Exit when r := "hello"; true -> !r
        ^^^^^^^^^^^^^^^^^^^^^
Error: Mixing value and exception patterns under when-guards is not supported.
|}]