Skip to content

Commit 98f6c11

Browse files
committed
update CHANGES.md and tests
1 parent 6110197 commit 98f6c11

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

Diff for: CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
## Improved
2323

24+
- Pattern-matching redundancy is now a warning instead of an error.
25+
[\#222](https://github.com/ocaml-gospel/gospel/pull/222)
2426
- Allow unit result in function header
2527
[\#215](https://github.com/ocaml-gospel/gospel/pull/215)
2628
- Highlight source locations when reporting errors.

Diff for: src/patmat.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,4 @@ let checks ~loc ty cases =
568568
let tyl = ty :: bools in
569569
check_exhaustive ~loc tyl pmat q bools;
570570
check_redundancy ~loc tyl pmat
571-
with W.Warning e -> Fmt.epr "%a@." W.pp_warn e
571+
with W.Warning e -> Fmt.pr "%a@." W.pp_warn e

Diff for: test/patterns/negative/redundant1.mli

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ val f : int -> int
44
| _ -> true
55
| 1i -> false *)
66
(* {gospel_expected|
7-
[125] File "redundant1.mli", line 3, characters 12-58:
8-
3 | ............match x with
9-
4 | | _ -> true
10-
5 | | 1i -> false...
11-
Error: The pattern-matching is redundant.
7+
[0] File "redundant1.mli", line 3, characters 12-58:
8+
3 | ............match x with
9+
4 | | _ -> true
10+
5 | | 1i -> false...
11+
Warning: The pattern-matching is redundant.
1212
Here is a case that is unused:
1313
1i.
14+
OK
1415
|gospel_expected} *)

Diff for: test/patterns/negative/redundant2.mli

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ val f : t -> int
88
| B (B A) -> false
99
| _ -> true *)
1010
(* {gospel_expected|
11-
[125] File "redundant2.mli", line 5, characters 12-103:
12-
5 | ............match x with
13-
6 | | A -> false
14-
7 | | B (B _) -> false
15-
8 | | B (B A) -> false
16-
9 | | _ -> true...
17-
Error: The pattern-matching is redundant.
11+
[0] File "redundant2.mli", line 5, characters 12-103:
12+
5 | ............match x with
13+
6 | | A -> false
14+
7 | | B (B _) -> false
15+
8 | | B (B A) -> false
16+
9 | | _ -> true...
17+
Warning: The pattern-matching is redundant.
1818
Here is a case that is unused:
1919
B B A.
20+
OK
2021
|gospel_expected} *)

Diff for: test/patterns/negative/redundant3.mli

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ val f : t -> int
77
| B (B A) -> false
88
| _ -> true *)
99
(* {gospel_expected|
10-
[125] File "redundant3.mli", line 5, characters 12-86:
11-
5 | ............match x with
12-
6 | | A | B _ -> false
13-
7 | | B (B A) -> false
14-
8 | | _ -> true...
15-
Error: The pattern-matching is redundant.
10+
[0] File "redundant3.mli", line 5, characters 12-86:
11+
5 | ............match x with
12+
6 | | A | B _ -> false
13+
7 | | B (B A) -> false
14+
8 | | _ -> true...
15+
Warning: The pattern-matching is redundant.
1616
Here is a case that is unused:
1717
B B A.
18+
OK
1819
|gospel_expected} *)

0 commit comments

Comments
 (0)