Skip to content

Commit 3538add

Browse files
authored
atddiff: fix incorrect direction reported for new variant cases (#373)
* atddiff: fix incorrect direction reported for new variant cases * Update changelog --------- Co-authored-by: Martin Jambon <[email protected]>
1 parent 07ca753 commit 3538add

6 files changed

+15
-9
lines changed

CHANGES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Unreleased
2+
-------------------
3+
4+
* atddiff: Fixed reports for new variant cases. They are now correctly
5+
reported as forward incompatibilities (#373)
6+
17
2.14.0 (2023-10-19)
28
-------------------
39

atddiff/src/lib/Compare.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ let report_structural_mismatches options def_tbl1 def_tbl2 shared_types :
441441
|> List.iter (fun json_name ->
442442
let loc, (_name, _an), _opt_e = List.assoc json_name named2 in
443443
add stacks {
444-
direction = Backward;
444+
direction = Forward;
445445
kind = Missing_variant { variant_name = json_name };
446446
location_old = None;
447447
location_new = Some (loc |> Loc.of_atd_loc);

atddiff/test/default/forward_incompatible_variant.expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Backward incompatibility:
1+
Forward incompatibility:
22
File "forward_incompatible_variant_new.atd", line 1, characters 42-43:
33
Case 'B' is new.
44
The following types are affected:

atddiff/test/default/json_variant_name_change.expected.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ Case 'dee' disappeared.
2222
The following types are affected:
2323
with_constructor_renames
2424

25-
Backward incompatibility:
25+
Forward incompatibility:
2626
File "json_variant_name_change_new.atd", line 2, characters 4-22:
2727
Case 'a!' is new.
2828
The following types are affected:
2929
with_constructor_renames
3030

31-
Backward incompatibility:
31+
Forward incompatibility:
3232
File "json_variant_name_change_new.atd", line 3, characters 4-29:
3333
Case 'b!' is new.
3434
The following types are affected:
3535
with_constructor_renames
3636

37-
Backward incompatibility:
37+
Forward incompatibility:
3838
File "json_variant_name_change_new.atd", line 4, characters 4-5:
3939
Case 'C' is new.
4040
The following types are affected:
4141
with_constructor_renames
4242

43-
Backward incompatibility:
43+
Forward incompatibility:
4444
File "json_variant_name_change_new.atd", line 5, characters 4-12:
4545
Case 'D' is new.
4646
The following types are affected:

atddiff/test/default/recursive.expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Backward incompatibility:
1+
Forward incompatibility:
22
File "recursive_new.atd", line 9, characters 52-53:
33
Case 'B' is new.
44
The following types are affected:

atddiff/test/json_output/all_errors.expected.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
},
101101
{
102102
"finding": {
103-
"direction": "Backward",
103+
"direction": "Forward",
104104
"kind": [ "Missing_variant", { "variant_name": "New_case" } ],
105105
"location_new": {
106106
"start": { "path": "all_errors_new.atd", "line": 13, "column": 4 },
@@ -112,7 +112,7 @@
112112
},
113113
{
114114
"finding": {
115-
"direction": "Backward",
115+
"direction": "Forward",
116116
"kind": [
117117
"Missing_variant", { "variant_name": "New_case_with_arg" }
118118
],

0 commit comments

Comments
 (0)