Skip to content

[bug] error reporting for res/resi/ conflict is hard to parse? #7950

@tx46

Description

@tx46

i guess this is pretty opinionated of me but to me, it's hard to read:

  The implementation <project path>/src/utils.res
  does not match the interface ../ocaml/utils.cmi:
  Values do not match:
    let anyToJson: (
  'a,
  ~breakCycle: ('a, array<string>) => JSON.t=?,
  ~encodeBigInt: BigInt.t => JSON.t=?,
  ~encodeSymbol: Symbol.t => JSON.t=?,
  ~encodeFunction: {..} => JSON.t=?,
) => JSON.t
  is not included in
    let anyToJson: (
  'a,
  ~breakCycle: ('a, array<string>) => JSON.t=?,
  ~encodeBigInt: BigInt.t => JSON.t=?,
  ~encodeSymbol: Symbol.t => JSON.t=?,
  ~encodeFunction: 'a => JSON.t=?,
) => JSON.t
  <project path>/src/utils.resi:1:1-7:11:
    Expected declaration
  <project path>/src/utils.res:69:5-13:
    Actual declaration
  1. the formatting and indentation is all weird
  2. it doesn't immediately tell me what the problem is
  3. it says something about Expected declaration which makes it even more confusin
  The implementation <project path>/src/utils.res
  does not match its expected interface:

  Implementation:

    let anyToJson: (
      'a,
      ~breakCycle: ('a, array<string>) => JSON.t=?,
      ~encodeBigInt: BigInt.t => JSON.t=?,
      ~encodeSymbol: Symbol.t => JSON.t=?,
      ~encodeFunction: {..} => JSON.t=?,
    ) => JSON.t

  Declaration:

    let anyToJson: (
      'a,
      ~breakCycle: ('a, array<string>) => JSON.t=?,
      ~encodeBigInt: BigInt.t => JSON.t=?,
      ~encodeSymbol: Symbol.t => JSON.t=?,
      ~encodeFunction: 'a => JSON.t=?,
    ) => JSON.t

  ~encodeFunction has the following type in implementation: {..} => JSON.t=?,
  but should have this type according to interface:         'a => JSON.t=?

i don't need to see something about a .cmi file, and it's always easy enough to grep that i don't need to see line and column numbers for both implementation and declaration anyway. it's probably more common that a file is so small that reading the convoluted message costs me more time than the off-chance that the module is an absolute huge monolith to the point it'd save me time, so all in all, better to remove it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions