Skip to content

improve function type error messages by showing what's incompatible #25170

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

Closed
jmesserly opened this issue Dec 8, 2015 · 3 comments
Closed

improve function type error messages by showing what's incompatible #25170

jmesserly opened this issue Dec 8, 2015 · 3 comments
Labels
closed-duplicate Closed in favor of an existing report legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@jmesserly
Copy link

Function type error messages from strong-mode can be hard to understand. It took me a while to decipher this:

Invalid override. The type of FunctionTypeImpl.substitute2 ((List<DartType>, List<DartType>, [List<FunctionTypeAliasElement>]) → DartType) is not a subtype of FunctionType.substitute2 ((List<DartType>, List<DartType>) → FunctionType).lib/src/generated/element.dart, line 5713

I think the issue is the horizontal scrolling ... the thing that's wrong is pushed way off the right side, in both Atom and IntelliJ it's very hard to see the return type is different.

@vsmenon had an idea: we can instead say something about the return type:

Return type DartType is not a subtype of FunctionType, in the override FunctionTypeImpl.substitute2 (overridden from FunctionType.substitute2).

I'd be good to check other tools (for Dart but also other languages) to get some ideas on what works best here.

Of course, they won't always be that easy, but a few special cases can probably handle a lot of the common errors.

@bwilkerson
Copy link
Member

Specializing the error message would be fantastic. We'll still need the general case for times when there are so many problems that a specialized message doesn't make sense, but hopefully that will be rare.

@jmesserly
Copy link
Author

FWIW, this is now implemented in ErrorVerifier, so if we merge CodeChecker's checks into ErrorVerifier we'll get the better error messages.

@jmesserly
Copy link
Author

I'm going to dupe this in #25350, since merging the two systems will fix the error

@jmesserly jmesserly added the closed-duplicate Closed in favor of an existing report label Jan 14, 2016
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed Priority-Medium labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants