location information in the typing error message could be made more precise #7315
Original bug ID: 7315
type foo = (unit,unit,unit,unit,unit,unit) bar;;
Ocaml (correctly) reports that:
Error: Unbound type constructor bar
What I do not understand is why the location information is so vague.
Why doesn't it provide a more precise location, i.e. where
identifier actually occurs?
Steps to reproduce
echo 'type foo = (unit,unit,unit,unit,unit,unit) bar;;' | ocaml
Comment author: @gasche
This particular imprecision is fixed by the following one-line change:
diff --git a/typing/typetexp.ml b/typing/typetexp.ml
What are other error messages whose location should be similarly refined?
Comment author: kosik
I do not know about other scenarios in which Ocaml compiler produces unnecessarily vague location information. I can promise to report them once I spot them.
However, if Merlin has a separate typechecking engine from Ocaml compiler, it may also make sense to fix it in a similar way, because it behaves consistently (imprecisely) with the Ocaml compiler.