-
Notifications
You must be signed in to change notification settings - Fork 413
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
Unexpected type reported in type error #1794
Comments
This seems like an OCaml bug, could you report it upstream? |
Looks like they don't think it's a bug either |
Indeed. Looking at the example again, it doesn't look like a bug to me either. In any case, there is not much we can do in Dune. |
This makes it so that ~~~ocaml module M = struct type a let f (x:a) = x end type b = M.a let _ = M.f 2 ~~~ We get Error: This expression has type int but an expression was expected of type M.a instead of Error: This expression has type int but an expression was expected of type b We want this for Coq since we have numerous aliases in this pattern, eg module_ident = Id.t in names. See ocaml/dune#1794
This makes it so that ~~~ocaml module M = struct type a let f (x:a) = x end type b = M.a let _ = M.f 2 ~~~ We get Error: This expression has type int but an expression was expected of type M.a instead of Error: This expression has type int but an expression was expected of type b We want this for Coq since we have numerous aliases in this pattern, eg module_ident = Id.t in names. See ocaml/dune#1794 https://caml.inria.fr/mantis/view.php?id=7911
Very well then |
@SkySkimmer Perhaps you could try making it a private type alias:
And then you'll have to do all the coercions explicitly. That shouldn't be so bad, if there's really a semantic meaning to your alias. In general, you really want |
Got:
Expected:
In the original case
b
is an alias with some semantic meaning (even though as an alias it can't produce a strong guarantee) like https://github.com/coq/coq/blob/506136d60c0dcc4fc2a2ca83ef3b586fbede55a2/kernel/names.mli#L118 (andf
was https://github.com/coq/coq/blob/506136d60c0dcc4fc2a2ca83ef3b586fbede55a2/kernel/names.mli#L56)This behaviour is because of -short-paths (I guess from #1743 ?). I haven't reviewed the history of that commit but the commit message only talks about
ocamlc -i
, would it be possible to avoid using -short-paths for other commands (and also avoid putting it in .merlin)?The text was updated successfully, but these errors were encountered: