Git Product home page Git Product logo

Comments (4)

macdrevx avatar macdrevx commented on June 27, 2024

Note that this applies to the generated code.

from protobuf-objc.

jparise avatar jparise commented on June 27, 2024

Can you provide an example of the trailing whitespace in the generated code?

from protobuf-objc.

macdrevx avatar macdrevx commented on June 27, 2024

The definition

message Demo {
    optional string demo_field_1 = 1;
    optional string demo_field_2 = 2;
    optional string demo_field_3 = 3;
    optional string demo_field_4 = 4;
    optional string demo_field_5 = 5;
    optional string demo_field_6 = 6;
}

results in the generated code:

- (BOOL) isEqual:(id)other {
  if (other == self) {
    return YES;
  }
  if (![other isKindOfClass:[Demo class]]) {
    return NO;
  }
  Demo *otherMessage = other;
  return
      self.hasDemoField1 == otherMessage.hasDemoField1 &&
      (!self.hasDemoField1 || [self.demoField1 isEqual:otherMessage.demoField1]) &&

      self.hasDemoField2 == otherMessage.hasDemoField2 &&
      (!self.hasDemoField2 || [self.demoField2 isEqual:otherMessage.demoField2]) &&

      self.hasDemoField3 == otherMessage.hasDemoField3 &&
      (!self.hasDemoField3 || [self.demoField3 isEqual:otherMessage.demoField3]) &&

      self.hasDemoField4 == otherMessage.hasDemoField4 &&
      (!self.hasDemoField4 || [self.demoField4 isEqual:otherMessage.demoField4]) &&

      self.hasDemoField5 == otherMessage.hasDemoField5 &&
      (!self.hasDemoField5 || [self.demoField5 isEqual:otherMessage.demoField5]) &&

      self.hasDemoField6 == otherMessage.hasDemoField6 &&
      (!self.hasDemoField6 || [self.demoField6 isEqual:otherMessage.demoField6]) &&

      (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
}

The trailing whitespace is on the otherwise empty lines in the return statement.

from protobuf-objc.

macdrevx avatar macdrevx commented on June 27, 2024

Just recompiled with these fixes and found one more case. Here's the patch to fix it:

diff --git a/src/compiler/objc_enum_field.cc b/src/compiler/objc_enum_field.cc
index b85be1b..5e29026 100644
--- a/src/compiler/objc_enum_field.cc
+++ b/src/compiler/objc_enum_field.cc
@@ -215,7 +215,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
   void EnumFieldGenerator::GenerateIsEqualCodeSource(io::Printer* printer) const {
     printer->Print(variables_,
       "self.has$capitalized_name$ == otherMessage.has$capitalized_name$ &&\n"
-      "(!self.has$capitalized_name$ || self.$name$ != otherMessage.$name$) &&\n");
+      "(!self.has$capitalized_name$ || self.$name$ != otherMessage.$name$) &&");
   }


from protobuf-objc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.