OCaml gives me a pattern-match
warning on expressions I think are malformed, e.g., let x + 1 = 2
:
─( 13:26:24 )─< command 0 >────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # let x + 1 = 2;;
Line 1, characters 6-13:
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
0
val x : int -> int = <fun>
─( 13:26:25 )─< command 1 >────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # x 1;;
- : int = 2
─( 13:26:28 )─< command 2 >────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # x 2;;
Exception: Match_failure ("//toplevel//", 1, 6).
─( 13:26:30 )─< command 3 >────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # let x - 1 = 0;;
Line 1, characters 6-13:
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
0
val x : int -> int = <fun>
─( 13:26:32 )─< command 4 >────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # x (-1);;
- : int = 0
─( 13:26:36 )─< command 5 >────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # x 0;;
Exception: Match_failure ("//toplevel//", 1, 6).
Expressions like let x * 2 = 0
are rejected due to syntax error.
Is this a bug?