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

Upstreaming: Additional information in error messages #12

Open
cpovirk opened this issue Dec 30, 2020 · 4 comments
Open

Upstreaming: Additional information in error messages #12

cpovirk opened this issue Dec 30, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@cpovirk
Copy link
Collaborator

cpovirk commented Dec 30, 2020

(different from #9)

@wmdietl
Copy link
Collaborator

wmdietl commented Feb 6, 2024

Including more information in error messages would be great.

It would seem nice to consistently quote program text in error messages, e.g. to use incompatible argument for parameter ''value'' of ''Optional.of''.

Looking through the javac error messages there is no consistent style: sometimes symbols are in quotes, sometimes not.

Plugging in configurable extra error information also seems useful, but I would like to find a more general solution that works for more than just returns. The adaptation for ternaries would probably also be useful if the ternary is used in a method argument or an assignment.

@cpovirk
Copy link
Collaborator Author

cpovirk commented Feb 6, 2024

I'd be happy to see us not worry about this for now: As you say, the current approach helps only in some cases, and there is much more that we could discuss on the topic. If we're able to address the bigger issues of the de-forking first, then I'm confident that we can subsequently transition from "checker does the right thing but with sometimes confusing error messages" to "checker does the right thing with excellent error messages."

@wmdietl
Copy link
Collaborator

wmdietl commented Feb 6, 2024

That sounds good!

Regarding the comment about the caret position: the caret points at the argument; if that argument is another method invocation, it will point at the parenthesis in that invocation. So I don't think there is much to improve there.
But let's postpone all this until after #29.

@cpovirk
Copy link
Collaborator Author

cpovirk commented Feb 6, 2024

Caret placement may be hopeless :)

The current behavior is the one that is technically unambiguous, and that has a lot going for it. The problem is that we have plenty of experience with people who see...

error: blah blah blah
foo(bar())
   ^

...and naturally assume that the problem is with passing bar() to foo, rather than with doing something to the result of the foo call.

In the past 3(!) years, I think I've come around to your idea that the caret position is as good as it gets and that we need to do what we can with error messages

I wonder if we can learn from other tools. I know that Kotlin is quite bad about this in some cases but I think also decent in others.

@wmdietl wmdietl added the enhancement New feature or request label Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants