Skip to content

[Extension types] No error in analyzer if result of == operator is assigned to not bool #54080

Closed
@sgrekhov

Description

@sgrekhov

The following test works in CFE but fails in analyzer

// SharedOptions=--enable-experiment=inline-class

class C {
  BoolET operator ==(Object? other) {
    return BoolET(other == this);
  }
}

extension type BoolET(bool b) implements bool {}

main() {
  BoolET b = C() == C();  // No expected error in analyzer
//               ^
// [analyzer] unspecified
// [cfe] unspecified
}

According to the Dart spec "The static type of an equality expression is bool", so there should be an error here

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failuresfeature-extension-typesImplementation of the extension type featurelegacy-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