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

Wrong analyzer error message when unnamed constructor returns wrong type #27387

Closed
sgrekhov opened this issue Sep 19, 2016 · 1 comment
Closed
Assignees
Labels
analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

@sgrekhov
Copy link
Contributor

sgrekhov commented Sep 19, 2016

The code is the following:

abstract class I<T> {
  factory I() {
    return new C<T>();
  }
}

class C<T> implements I {
}

main() {
  new C();
  new I();
}

Analizer output (in a strong mode) is: [error] The return type 'C<T>' is not a 'I<T>', as defined by the method ''

Note empty method name in an error message. Tested in dartanalyzer version 1.20.0-dev.5.0

@bwilkerson bwilkerson added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-strong-mode P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Sep 19, 2016
@jmesserly
Copy link

Thanks for filing this! Referring to the unnamed constructor with '' is confusing.

However it is not a strong mode specific error, so I'm going to adjust the labels.
Here is the non-strong-mode repro:

abstract class I<T> {
  factory I() {
    return new C<T>();
  }
}

class C<T> {
}

main() {
  new C();
  new I();
}
[warning] The return type 'C<T>' is not a 'I<T>', as defined by the method ''.

@srawlins srawlins changed the title Wrong analyzer error message Wrong analyzer error message when unnamed constructor returns wrong type Jun 8, 2020
@srawlins srawlins self-assigned this Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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