Skip to content

Analyzer doesn't warn for comparison of unrelated type extension values #59423

@tjarvstrand

Description

@tjarvstrand

The below code doesn't cause the analyzer to emit any warning for comparison of unrelated types:

extension type A(String value) implements String {}
extension type B(String value) implements String {}

void main() {
  final a = A('a');
  final b = B('b');
  if (a == b) {
    print('no');
  }
}

Flutter doctor:

[✓] Flutter (Channel stable, 3.19.1, on macOS 13.5.1 22G90 darwin-arm64, locale en-SE)
    • Flutter version 3.19.1 on channel stable at /Users/xxx/.cache/asdf/installs/flutter/3.19.1-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision abb292a07e (13 days ago), 2024-02-20 14:35:05 -0800
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-false-negativeIssues related to lint rules that fail to report a problem.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