dune icon indicating copy to clipboard operation
dune copied to clipboard

usability: include a blank line between separate compiler messages (errors, warnings)

Open gasche opened this issue 3 years ago • 0 comments

In https://github.com/ocaml/ocaml/issues/11539, @mimoo reports the following error message they (understandably) found hard to read

File "src/lib/mina_base/control.ml", lines 11-15, characters 4-51:
11 | ....type t = Mina_wire_types.Mina_base.Control.V2.t =
12 |       | Proof of Pickles.Side_loaded.Proof.Stable.V2.t
13 |       | Signature of Signature.Stable.V1.t
14 |       | None_given
15 |     [@@deriving sexp, equal, yojson, hash, compare]
Error: This variant or record definition does not match that of type
         Mina_wire_types.Mina_base.Control.V2.t
       Constructors do not match:
         Signature of Mina_wire_types.Mina_base_signature.V1.t
       is not the same as:
         Signature of Mina_base__.Signature.Stable.V1.t
       The type
         Mina_wire_types.Mina_base_signature.V1.t =
           Mina_wire_types.Snark_params.Tick.Field.t *
           Mina_wire_types.Snark_params.Tick.Inner_curve.Scalar.t
       is not equal to the type
         Mina_base__.Signature.Stable.V1.t =
           Snark_params.Tick.Field.t * Snark_params.Tick.Inner_curve.Scalar.t
       Type Mina_wire_types.Snark_params.Tick.Field.t = Pasta_bindings.Fp.t
       is not equal to type
         Snark_params.Tick.Field.t = Pasta_bindings.Fp256.t 
File "src/lib/mina_base/stake_delegation.ml", lines 9-14, characters 4-51:
 9 | ....type t = Mina_wire_types.Mina_base.Stake_delegation.V1.t =
10 |       | Set_delegate of
11 |           { delegator : Public_key.Compressed.Stable.V1.t
12 |           ; new_delegate : Public_key.Compressed.Stable.V1.t
13 |           }
14 |     [@@deriving compare, equal, sexp, hash, yojson]
Error: This variant or record definition does not match that of type
         Mina_wire_types.Mina_base.Stake_delegation.V1.t
       Constructors do not match:
         Set_delegate of {
           delegator : Mina_wire_types.Public_key.Compressed.V1.t;
           new_delegate : Mina_wire_types.Public_key.Compressed.V1.t;
         }
       is not the same as:
         Set_delegate of {
           delegator : Signature_lib.Public_key.Compressed.Stable.V1.t;
           new_delegate : Signature_lib.Public_key.Compressed.Stable.V1.t;
         }
       1. Fields do not match:
         delegator : Mina_wire_types.Public_key.Compressed.V1.t;
       is not the same as:
         delegator : Signature_lib.Public_key.Compressed.Stable.V1.t;
       The type
         Mina_wire_types.Public_key.Compressed.V1.t =
           (Mina_wire_types.Snark_params.Tick.Field.t, bool)
           Mina_wire_types.Public_key.Compressed.Poly.V1.t
       is not equal to the type
         Signature_lib.Public_key.Compressed.Stable.V1.t =
           (Snark_params.Tick.Field.t, bool)
           Mina_wire_types.Public_key.Compressed.Poly.V1.t
       Type Mina_wire_types.Snark_params.Tick.Field.t = Pasta_bindings.Fp.t
       is not equal to type
         Snark_params.Tick.Field.t = Pasta_bindings.Fp256.t 
       2. Fields do not match:
         new_delegate : Mina_wire_types.Public_key.Compressed.V1.t;
       is not the same as:
         new_delegate : Signature_lib.Public_key.Compressed.Stable.V1.t;
       The type
         Mina_wire_types.Public_key.Compressed.V1.t =
           (Mina_wire_types.Snark_params.Tick.Field.t, bool)
           Mina_wire_types.Public_key.Compressed.Poly.V1.t
       is not equal to the type
         Signature_lib.Public_key.Compressed.Stable.V1.t =
           (Snark_params.Tick.Field.t, bool)
           Mina_wire_types.Public_key.Compressed.Poly.V1.t
       Type Mina_wire_types.Snark_params.Tick.Field.t = Pasta_bindings.Fp.t
       is not equal to type
         Snark_params.Tick.Field.t = Pasta_bindings.Fp256.t 
File "src/lib/mina_base/fee_transfer.mli", lines 6-7, characters 9-56:
6 | .........type Single.Stable.V2.t =
7 |       Mina_wire_types.Mina_base.Fee_transfer.Single.V2.t
Error: This variant or record definition does not match that of type
         Mina_wire_types.Mina_base.Fee_transfer.Single.V2.t
       Fields do not match:
         receiver_pk : Mina_wire_types.Public_key.Compressed.V1.t;
       is not the same as:
         receiver_pk : Mina_base_import.Public_key.Compressed.Stable.V1.t;
       The type
         Mina_wire_types.Public_key.Compressed.V1.t =
           (Mina_wire_types.Snark_params.Tick.Field.t, bool)
           Mina_wire_types.Public_key.Compressed.Poly.V1.t
       is not equal to the type
         Mina_base_import.Public_key.Compressed.Stable.V1.t =
           (Snark_params.Tick.Field.t, bool)
           Mina_wire_types.Public_key.Compressed.Poly.V1.t
       Type Mina_wire_types.Snark_params.Tick.Field.t = Pasta_bindings.Fp.t
       is not equal to type
         Snark_params.Tick.Field.t = Pasta_bindings.Fp256.t 

One reason the user is confused is that this is not one error, but in fact three error messages concatenated together, and they had not realized this. (Each error message individually is tough but still easier to grok.)

Feature request: when Dune reports several messages, include a blank line between each message, so that users can visually notice that they are separate error messages.

(In terminal output there typically are colors that help highlight the Error: part, but maybe this was not enough for the user, and maybe they are looking at CI logs or another output that does not include the colors/highlighting.)

gasche avatar Sep 22 '22 07:09 gasche