Skip to content

Analyzer error message on incompatible functions is very confusing #23492

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
leafpetersen opened this issue May 19, 2015 · 2 comments
Closed
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@leafpetersen
Copy link
Member

Running the analyzer (version 1.11.0-dev.0.0) on the attached file produces the following very confusing error message:

leafp@leafp-linux:~/src/dev_compiler$ dartanalyzer ~/tmp/function-warning.dart
Analyzing [/usr/local/google/home/leafp/tmp/function-warning.dart]...
[warning] A value of type 'Function2 (/usr/local/google/home/leafp/tmp/function-warning.dart)' cannot be assigned to a variable of type 'Function2 (/usr/local/google/home/leafp/tmp/function-warning.dart)' (/usr/local/google/home/leafp/tmp/function-warning.dart, line 12, col 27)
[hint] The value of the local variable 'a2b' is not used (/usr/local/google/home/leafp/tmp/function-warning.dart, line 12, col 21)
1 warning found.

Neither typedef instantiation gets printed out with its arguments, so the error message basically says "Function2 cannot be assigned to Function2", which is fairly confusing. I would expect an error message that looked something like "Function2<int, double> cannot be assigned to a variable of type Function2<A, B>".


Attachment:
function-warning.dart (312 Bytes)

@bwilkerson
Copy link
Member

Removed Priority-Unassigned label.
Added Priority-Medium label.

@bwilkerson bwilkerson removed the Triaged label Nov 4, 2015
@bwilkerson bwilkerson self-assigned this Nov 10, 2015
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Priority-Medium labels Mar 1, 2016
@bwilkerson bwilkerson removed their assignment Jun 9, 2016
@srawlins
Copy link
Member

The attached file no longer exists. I'm going to mark this as stale, as I believe this has been reported elsewhere, and is either fixed, or tracked on a separate bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants