Skip to content

Commit

Permalink
fix(rpc): correct severity of error diagnostic (#8193)
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Caglayan <alizter@gmail.com>
  • Loading branch information
Alizter authored Jul 14, 2023
1 parent 103c503 commit a8cd7e4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Unreleased
- Add `dune show installed-libraries` as an alias of the `dune
installed-libraries` command. (#8135, @Alizter)

- Fix the `severity` of error messages sent over RPC which was missing. (#8193,
@Alizter)

- Add `dune build --dump-gc-stats FILE` argument to dump garbage collection
stats to a named file. (#8072, @Alizter)

Expand Down
3 changes: 2 additions & 1 deletion src/dune_rpc_impl/diagnostics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ let diagnostic_of_error : Build_system.Error.t -> Dune_rpc_private.Diagnostic.t
; loc = make_loc (Option.value_exn related.loc)
})
in
{ Dune_rpc_private.Diagnostic.severity = None
{ Dune_rpc_private.Diagnostic.severity =
Some Dune_rpc_private.Diagnostic.Error
; id
; targets = []
; message = make_message message.paragraphs
Expand Down
12 changes: 12 additions & 0 deletions test/expect-tests/dune_rpc_e2e/dune_rpc_diagnostics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ let%expect_test "related error" =
]
]
]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}];
Expand Down Expand Up @@ -268,6 +269,7 @@ let%expect_test "related error" =
]
]
]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}]
Expand Down Expand Up @@ -320,6 +322,7 @@ let%expect_test "promotion" =
]
]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}]
Expand Down Expand Up @@ -377,6 +380,7 @@ let%expect_test "optional promotion" =
]
]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}]
Expand Down Expand Up @@ -429,6 +433,7 @@ let%expect_test "error from user rule" =
]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}]
Expand Down Expand Up @@ -469,6 +474,7 @@ let%expect_test "library error location" =
]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}]
Expand Down Expand Up @@ -519,6 +525,7 @@ let%expect_test "create and fix error" =
]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}];
Expand Down Expand Up @@ -560,6 +567,7 @@ let%expect_test "create and fix error" =
]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}]);
Expand Down Expand Up @@ -709,6 +717,7 @@ let g = A.f
" ] ]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
]
Expand Down Expand Up @@ -736,6 +745,7 @@ let g = A.f
" ] ]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
]
Expand Down Expand Up @@ -763,6 +773,7 @@ let g = A.f
" ] ]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
]
Expand Down Expand Up @@ -790,6 +801,7 @@ let g = A.f
" ] ]
; [ "promotion"; [] ]
; [ "related"; [] ]
; [ "severity"; "error" ]
; [ "targets"; [] ]
]
] |}]);
Expand Down

0 comments on commit a8cd7e4

Please sign in to comment.