-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Show real type names in error messages #4355
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
Comments
I was really confused because of this at first, when reading Dotty error messages. I absolutely concur that error messages should not make up facts such as " Also, the current Instead, why not change the
Or, which I would personally find better, keep a shortened prefix (only in case of ambiguity obviously):
|
I'm not a fan of either solution |
Isn't that exactly what is being done now, but with less clarity? How will users know which types Expr1 and Expr2 are, if you're not going to list the set of renamings? |
We can also have a longer description such as "Expr1 is an object in package foo.bla.baz". I just dislike using import renaming to express this. Note that import renaming is not enough anyway because some types do not have a stable path, e.g.: class Foo {
def meth = {
class Expr
def expr(e: Expr) = {}
def bla = {
class Expr
expr(new Expr)
}
}
} Here's the error Dotty outputs currently: 8 | expr(new Expr)
| ^^^^
| found: Expr
| required: Expr'
|
| where: Expr is a class in method bla
| Expr' is a class in method meth |
Import renaming also seems unconvincing, but again, we shouldn't write that Expr1 isn't an object, because that object is called Expr. I'd say that Expr1 isn't an object.
I agree with Unicode subscripts are better if we can rely on Unicode, since they're not allowed in Scala. Which we probably often can. Otherwise, |
Reading through this, it's a bit hard to actually pinpoint what we're trying to fix compared to where we're at now. In the linked issue some of the code samples that were marked failing now work, and the output is a bit different as well. Is there a minimal code sample that can be provided here to show what exactly it is we're trying to fix/enhance? |
In #4323 I was concerned about writing incorrect names for types in error messages.
because it's false that "
Expr'
is a trait". A bit better would be:But even better would be to have a clearer syntax for these "footnotes", something where the annotation is more clearly separate from the Scala syntax. For instance, if we use
@
(which is reserved and can't be used in types, I think):The text was updated successfully, but these errors were encountered: