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

Could we smartly elide some info from types in error messages? #43354

Closed
nrc opened this issue Jul 20, 2017 · 2 comments
Closed

Could we smartly elide some info from types in error messages? #43354

nrc opened this issue Jul 20, 2017 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nrc
Copy link
Member

nrc commented Jul 20, 2017

If there is a type error where the outer types don't match (e.g., Foo<T> != Bar<U>) we could elide the un-important type info (e.g., report Foo<...> != Bar<...>. This would be effective where there are very long, complex types such as iterators or closures.

@nrc nrc added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 20, 2017
@estebank
Copy link
Contributor

@nrc we already elide matching type arguments when the outer types match (Foo<A, B> != Foo<A, A> -> Foo<_, B> != Foo<_, A>).

The heuristic to elide the presentation of all type arguments should be a bit more involved than "outer types don't match" to avoid hiding cases like:

  • Some(X) != X and vice bersa
  • Foo<A, B> != Bar<A, B>
  • Option<A> != Result<A, B>

I think we should only do what is proposed here if under the current output both lines would be "fully highlighted", and even then, I'd only do it if the line is over a certain length.

</2¢>

@jackh726
Copy link
Member

I'm going to go ahead and close this. I think for this to be actionable, we need specific examples of code that gives bad diagnostics today; otherwise, we just end up with an issue without some concrete way to know when it should be closed. As @estebank mentions, we do (for a long time) elide matching type arguments. There's also been #57413 that has been merged since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants