Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

information in the typing error message could be made more precise #7318

Closed
vicuna opened this issue Aug 4, 2016 · 2 comments
Closed

information in the typing error message could be made more precise #7318

vicuna opened this issue Aug 4, 2016 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Aug 4, 2016

Original bug ID: 7318
Reporter: kosik
Status: acknowledged (set by @damiendoligez on 2016-11-08T10:49:30Z)
Resolution: open
Priority: low
Severity: feature
Version: 4.03.0
Target version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Category: typing

Bug description

When I type:

  module M1 =
  struct
    type t = V0 | V1
  end

  (* M1 and M2 are equivalent *)
  module M2 =
  struct
    type t = M1.t = V0 | V1
  end

  (* M1 and M3 are not equivalent *)
  module M3 =
  struct
    type t = V0 | V1
  end

  module M4 =
  struct
    type t = {f0 : unit * unit * unit * M1.t * unit * unit * unit;
              f1 : unit * unit * unit * M1.t * unit * unit * unit}
  end

  (* A failed attempt to define a module equivalent to M4 *)
  module M5 =
  struct
    type t = M4.t = {f0 : unit * unit * unit * M2.t * unit * unit * unit;
                     f1 : unit * unit * unit * M3.t * unit * unit * unit}
  end

then the compiler (correctly) complains that:

  Error: This variant or record definition does not match that of type M4.t
         The types for field f1 are not equal.

The compiler marks the whole record definition.

Couldn't compiler mark the location of the particular field of the record whose type breaks the desired equality? (in this case "f1 : unit * unit * unit * M3.t * unit * unit * unit")

Or, even better, would it be possible to mark the location of the specific type-sub-term that breaks the equality? (in this case "M3.t")?

@vicuna vicuna added the typing label Mar 14, 2019
@vicuna vicuna added this to the 4.05.0 milestone Mar 14, 2019
@github-actions
Copy link

github-actions bot commented May 9, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 9, 2020
@Drup
Copy link
Contributor

Drup commented May 9, 2020

This has been improved significantly, here's the current error message:

Error: This variant or record definition does not match that of type M4.t
       Fields do not match:
         f1 : unit * unit * unit * M1.t * unit * unit * unit;
       is not compatible with:
         f1 : unit * unit * unit * M3.t * unit * unit * unit;
       The types are not equal.

@trefis trefis closed this as completed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants