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

Open
nrc opened this Issue Jul 20, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@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.

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jul 22, 2017

@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¢>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.