Skip to content

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

@sgrekhov

Description

@sgrekhov

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

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ondevexp-uxlegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions