Skip to content

Bug with field named other in equals code generator #408

Open
@noguespi

Description

@noguespi

At the moment we can't have a field named "other" because it will cause an error like this:

Comparison with '==' might not be intended because 'String' and 'AddressProto' are incompatible types.

  override fun equals(other: Any?): Boolean =
    other is AddressProto &&
      other.addressLine1 == addressLine1 &&
      other.addressLine2 == addressLine2 &&
      other.city == city &&
      other.zip == zip &&
      other.other == other && // comparing "other.other" field with other "object", we want to compare other.other with this.other
      other.unknownFields == unknownFields

Maybe adding this in MessageGenerator is the way to fix this ? :

main...noguespi:protokt:patch-2#diff-1dc59ca0386206a2e6ba6791f87af9a6f3fa24a617b8bd39e963d6d1e97d7eac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions