Skip to content

Commit

Permalink
atddiff: fix incorrect direction reported for new variant cases (#373)
Browse files Browse the repository at this point in the history
* atddiff: fix incorrect direction reported for new variant cases

* Update changelog

---------

Co-authored-by: Martin Jambon <[email protected]>
  • Loading branch information
mjambon and mjambon authored Oct 20, 2023
1 parent 07ca753 commit 3538add
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Unreleased
-------------------

* atddiff: Fixed reports for new variant cases. They are now correctly
reported as forward incompatibilities (#373)

2.14.0 (2023-10-19)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion atddiff/src/lib/Compare.ml
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ let report_structural_mismatches options def_tbl1 def_tbl2 shared_types :
|> List.iter (fun json_name ->
let loc, (_name, _an), _opt_e = List.assoc json_name named2 in
add stacks {
direction = Backward;
direction = Forward;
kind = Missing_variant { variant_name = json_name };
location_old = None;
location_new = Some (loc |> Loc.of_atd_loc);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Backward incompatibility:
Forward incompatibility:
File "forward_incompatible_variant_new.atd", line 1, characters 42-43:
Case 'B' is new.
The following types are affected:
Expand Down
8 changes: 4 additions & 4 deletions atddiff/test/default/json_variant_name_change.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ Case 'dee' disappeared.
The following types are affected:
with_constructor_renames

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

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

Backward incompatibility:
Forward incompatibility:
File "json_variant_name_change_new.atd", line 4, characters 4-5:
Case 'C' is new.
The following types are affected:
with_constructor_renames

Backward incompatibility:
Forward incompatibility:
File "json_variant_name_change_new.atd", line 5, characters 4-12:
Case 'D' is new.
The following types are affected:
Expand Down
2 changes: 1 addition & 1 deletion atddiff/test/default/recursive.expected.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Backward incompatibility:
Forward incompatibility:
File "recursive_new.atd", line 9, characters 52-53:
Case 'B' is new.
The following types are affected:
Expand Down
4 changes: 2 additions & 2 deletions atddiff/test/json_output/all_errors.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
},
{
"finding": {
"direction": "Backward",
"direction": "Forward",
"kind": [ "Missing_variant", { "variant_name": "New_case" } ],
"location_new": {
"start": { "path": "all_errors_new.atd", "line": 13, "column": 4 },
Expand All @@ -112,7 +112,7 @@
},
{
"finding": {
"direction": "Backward",
"direction": "Forward",
"kind": [
"Missing_variant", { "variant_name": "New_case_with_arg" }
],
Expand Down

0 comments on commit 3538add

Please sign in to comment.