Skip to content

Should inline class members with same names as those of the field be targets of lint?  #3168

Open
@Cat-sushi

Description

@Cat-sushi

For the same reason of prohibiting to override toString(), it is very confusing.

inline class Id {
  final int value;
  Id(this.value);
  bool get isEven => value.isOdd; // lying. Should this be a target of lint?
}

main() {
  Id id = Id(123);
  print(id.isEven); // true (deceived)
  dynamic d = id;
  print(d.isEven); // false
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-types-laterIssues about extension types for later consideration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions