|
1 | 1 | (*
|
2 | 2 | Type definitions used to build comparison results
|
| 3 | + |
| 4 | + We don't derive OCaml serializers from this file with atdgen due to |
| 5 | + circular dependencies but we derive the OCaml types by calling atdgen |
| 6 | + and keeping the result under source control: |
| 7 | + |
| 8 | + atdgen -t Atddiff_output.atd |
| 9 | + |
| 10 | + This provides an ATD specification to users who consume the JSON |
| 11 | + output of the atddiff. |
3 | 12 | *)
|
4 | 13 |
|
5 |
| -type direction = Backward | Forward | Both |
| 14 | +type position = { |
| 15 | + path: string; |
| 16 | + line: int; |
| 17 | + column: int; |
| 18 | +} |
| 19 | + |
| 20 | +type location = { |
| 21 | + start: position; |
| 22 | + end <ocaml name="end_">: position; |
| 23 | +} |
| 24 | + |
| 25 | +type direction = [ Backward | Forward | Both ] <ocaml repr="classic"> |
6 | 26 |
|
7 |
| -type incompatibility_kind = |
8 |
| - | Missing_field of { field_name: string } |
9 |
| - | Missing_variant of { variant_name: string } |
10 |
| - | Missing_variant_argument of { variant_name: string } |
11 |
| - | Default_required of { field_name: string } |
| 27 | +type field_info = { |
| 28 | + field_name: string |
| 29 | +} |
| 30 | + |
| 31 | +type variant_info = { |
| 32 | + variant_name: string |
| 33 | +} |
| 34 | + |
| 35 | +type incompatibility_kind = [ |
| 36 | + | Missing_field of field_info |
| 37 | + | Missing_variant of variant_info |
| 38 | + | Missing_variant_argument of variant_info |
| 39 | + | Default_required of field_info |
12 | 40 | | Incompatible_type
|
13 | 41 | | Deleted_type
|
14 | 42 | | Added_type
|
| 43 | +] <ocaml repr="classic"> |
15 | 44 |
|
16 | 45 | (*
|
17 | 46 | Important things we want to report:
|
@@ -49,20 +78,22 @@ type incompatibility_kind =
|
49 | 78 | type finding = {
|
50 | 79 | direction: direction;
|
51 | 80 | kind: incompatibility_kind;
|
52 |
| - location_old: Atd.Ast.loc option; |
53 |
| - location_new: Atd.Ast.loc option; |
| 81 | + location_old: location option; |
| 82 | + location_new: location option; |
54 | 83 |
|
55 | 84 | (* The description should not mention the affected root type definition
|
56 | 85 | so as to allow the deduplication of findings. *)
|
57 | 86 | description: string;
|
58 | 87 | }
|
59 | 88 |
|
60 |
| -(* |
61 |
| - A result is a list of unique findings and the list of root types |
62 |
| - affected by the finding. |
| 89 | +type full_finding = { |
| 90 | + finding: finding; |
| 91 | + affected_types: string list; |
| 92 | +} |
63 | 93 |
|
64 |
| - For now, we don't try to identify root type renames so each finding is |
65 |
| - associated to just one root type name which exists in one or both versions |
66 |
| - of the file. |
| 94 | +(* |
| 95 | + A result is a list of unique findings. |
67 | 96 | *)
|
68 |
| -type result = (finding * string list) list |
| 97 | +type result = { |
| 98 | + findings: full_finding list; |
| 99 | +} |
0 commit comments