Sync changes from internal repo. (#98)

diff --git a/lib/src/protobuf/generated_message.dart b/lib/src/protobuf/generated_message.dart
index 2ca4611..2f655da 100644
--- a/lib/src/protobuf/generated_message.dart
+++ b/lib/src/protobuf/generated_message.dart
@@ -67,8 +67,12 @@
   // TODO(antonm): move to getters.
   int getTagNumber(String fieldName) => info_.tagNumber(fieldName);
 
-  bool operator ==(other) =>
-      other is GeneratedMessage ? _fieldSet._equals(other._fieldSet) : false;
+  bool operator ==(other) {
+    if (identical(this, other)) return true;
+    return other is GeneratedMessage
+        ? _fieldSet._equals(other._fieldSet)
+        : false;
+  }
 
   /// Calculates a hash code based on the contents of the protobuf.
   ///