/*
 * DO NOT EDIT.
 *
 * Generated by the protocol buffer compiler.
 * Source: google/protobuf/unittest_proto3.proto
 *
 */

//  Protocol Buffers - Google's data interchange format
//  Copyright 2008 Google Inc.  All rights reserved.
//  https://developers.google.com/protocol-buffers/
// 
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are
//  met:
// 
//      * Redistributions of source code must retain the above copyright
//  notice, this list of conditions and the following disclaimer.
//      * Redistributions in binary form must reproduce the above
//  copyright notice, this list of conditions and the following disclaimer
//  in the documentation and/or other materials provided with the
//  distribution.
//      * Neither the name of Google Inc. nor the names of its
//  contributors may be used to endorse or promote products derived from
//  this software without specific prior written permission.
// 
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
//  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
//  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
//  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
//  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
//  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
//  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
//  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
//  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
//  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
//  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

//  Author: kenton@google.com (Kenton Varda)
//   Based on original Protocol Buffers design by
//   Sanjay Ghemawat, Jeff Dean, and others.
// 
//  A proto file we will use for unit testing.

import Foundation
import SwiftProtobuf


enum Proto3ForeignEnum: SwiftProtobuf.Enum {
  typealias RawValue = Int
  case foreignUnspecified // = 0
  case foreignFoo // = 4
  case foreignBar // = 5
  case foreignBaz // = 6
  case UNRECOGNIZED(Int)

  init() {
    self = .foreignUnspecified
  }

  init?(rawValue: Int) {
    switch rawValue {
    case 0: self = .foreignUnspecified
    case 4: self = .foreignFoo
    case 5: self = .foreignBar
    case 6: self = .foreignBaz
    default: self = .UNRECOGNIZED(rawValue)
    }
  }

  init?(name: String) {
    switch name {
    case "foreignUnspecified": self = .foreignUnspecified
    case "foreignFoo": self = .foreignFoo
    case "foreignBar": self = .foreignBar
    case "foreignBaz": self = .foreignBaz
    default: return nil
    }
  }

  init?(jsonName: String) {
    switch jsonName {
    case "FOREIGN_UNSPECIFIED": self = .foreignUnspecified
    case "FOREIGN_FOO": self = .foreignFoo
    case "FOREIGN_BAR": self = .foreignBar
    case "FOREIGN_BAZ": self = .foreignBaz
    default: return nil
    }
  }

  init?(protoName: String) {
    switch protoName {
    case "FOREIGN_UNSPECIFIED": self = .foreignUnspecified
    case "FOREIGN_FOO": self = .foreignFoo
    case "FOREIGN_BAR": self = .foreignBar
    case "FOREIGN_BAZ": self = .foreignBaz
    default: return nil
    }
  }

  var rawValue: Int {
    get {
      switch self {
      case .foreignUnspecified: return 0
      case .foreignFoo: return 4
      case .foreignBar: return 5
      case .foreignBaz: return 6
      case .UNRECOGNIZED(let i): return i
      }
    }
  }

  var json: String {
    get {
      switch self {
      case .foreignUnspecified: return "\"FOREIGN_UNSPECIFIED\""
      case .foreignFoo: return "\"FOREIGN_FOO\""
      case .foreignBar: return "\"FOREIGN_BAR\""
      case .foreignBaz: return "\"FOREIGN_BAZ\""
      case .UNRECOGNIZED(let i): return String(i)
      }
    }
  }

  var hashValue: Int { return rawValue }

  var debugDescription: String {
    get {
      switch self {
      case .foreignUnspecified: return ".foreignUnspecified"
      case .foreignFoo: return ".foreignFoo"
      case .foreignBar: return ".foreignBar"
      case .foreignBaz: return ".foreignBaz"
      case .UNRECOGNIZED(let v): return ".UNRECOGNIZED(\(v))"
      }
    }
  }

}

///   Test an enum that has multiple values with the same number.
enum Proto3TestEnumWithDupValue: SwiftProtobuf.Enum {
  typealias RawValue = Int
  case testEnumWithDupValueUnspecified // = 0
  case foo1 // = 1
  case bar1 // = 2
  case baz // = 3
  case foo2 // = 1
  case bar2 // = 2
  case UNRECOGNIZED(Int)

  init() {
    self = .testEnumWithDupValueUnspecified
  }

  init?(rawValue: Int) {
    switch rawValue {
    case 0: self = .testEnumWithDupValueUnspecified
    case 1: self = .foo1
    case 2: self = .bar1
    case 3: self = .baz
    default: self = .UNRECOGNIZED(rawValue)
    }
  }

  init?(name: String) {
    switch name {
    case "testEnumWithDupValueUnspecified": self = .testEnumWithDupValueUnspecified
    case "foo1": self = .foo1
    case "bar1": self = .bar1
    case "baz": self = .baz
    case "foo2": self = .foo2
    case "bar2": self = .bar2
    default: return nil
    }
  }

  init?(jsonName: String) {
    switch jsonName {
    case "TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED": self = .testEnumWithDupValueUnspecified
    case "FOO1": self = .foo1
    case "BAR1": self = .bar1
    case "BAZ": self = .baz
    case "FOO2": self = .foo2
    case "BAR2": self = .bar2
    default: return nil
    }
  }

  init?(protoName: String) {
    switch protoName {
    case "TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED": self = .testEnumWithDupValueUnspecified
    case "FOO1": self = .foo1
    case "BAR1": self = .bar1
    case "BAZ": self = .baz
    case "FOO2": self = .foo2
    case "BAR2": self = .bar2
    default: return nil
    }
  }

  var rawValue: Int {
    get {
      switch self {
      case .testEnumWithDupValueUnspecified: return 0
      case .foo1: return 1
      case .bar1: return 2
      case .baz: return 3
      case .foo2: return 1
      case .bar2: return 2
      case .UNRECOGNIZED(let i): return i
      }
    }
  }

  var json: String {
    get {
      switch self {
      case .testEnumWithDupValueUnspecified: return "\"TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED\""
      case .foo1: return "\"FOO1\""
      case .bar1: return "\"BAR1\""
      case .baz: return "\"BAZ\""
      case .foo2: return "\"FOO2\""
      case .bar2: return "\"BAR2\""
      case .UNRECOGNIZED(let i): return String(i)
      }
    }
  }

  var hashValue: Int { return rawValue }

  var debugDescription: String {
    get {
      switch self {
      case .testEnumWithDupValueUnspecified: return ".testEnumWithDupValueUnspecified"
      case .foo1: return ".foo1"
      case .bar1: return ".bar1"
      case .baz: return ".baz"
      case .foo2: return ".foo2"
      case .bar2: return ".bar2"
      case .UNRECOGNIZED(let v): return ".UNRECOGNIZED(\(v))"
      }
    }
  }

}

///   Test an enum with large, unordered values.
enum Proto3TestSparseEnum: SwiftProtobuf.Enum {
  typealias RawValue = Int
  case testSparseEnumUnspecified // = 0
  case sparseA // = 123
  case sparseB // = 62374
  case sparseC // = 12589234
  case sparseD // = -15
  case sparseE // = -53452

  ///   In proto3, value 0 must be the first one specified
  ///   SPARSE_F = 0;
  case sparseG // = 2
  case UNRECOGNIZED(Int)

  init() {
    self = .testSparseEnumUnspecified
  }

  init?(rawValue: Int) {
    switch rawValue {
    case 0: self = .testSparseEnumUnspecified
    case 123: self = .sparseA
    case 62374: self = .sparseB
    case 12589234: self = .sparseC
    case -15: self = .sparseD
    case -53452: self = .sparseE
    case 2: self = .sparseG
    default: self = .UNRECOGNIZED(rawValue)
    }
  }

  init?(name: String) {
    switch name {
    case "testSparseEnumUnspecified": self = .testSparseEnumUnspecified
    case "sparseA": self = .sparseA
    case "sparseB": self = .sparseB
    case "sparseC": self = .sparseC
    case "sparseD": self = .sparseD
    case "sparseE": self = .sparseE
    case "sparseG": self = .sparseG
    default: return nil
    }
  }

  init?(jsonName: String) {
    switch jsonName {
    case "TEST_SPARSE_ENUM_UNSPECIFIED": self = .testSparseEnumUnspecified
    case "SPARSE_A": self = .sparseA
    case "SPARSE_B": self = .sparseB
    case "SPARSE_C": self = .sparseC
    case "SPARSE_D": self = .sparseD
    case "SPARSE_E": self = .sparseE
    case "SPARSE_G": self = .sparseG
    default: return nil
    }
  }

  init?(protoName: String) {
    switch protoName {
    case "TEST_SPARSE_ENUM_UNSPECIFIED": self = .testSparseEnumUnspecified
    case "SPARSE_A": self = .sparseA
    case "SPARSE_B": self = .sparseB
    case "SPARSE_C": self = .sparseC
    case "SPARSE_D": self = .sparseD
    case "SPARSE_E": self = .sparseE
    case "SPARSE_G": self = .sparseG
    default: return nil
    }
  }

  var rawValue: Int {
    get {
      switch self {
      case .testSparseEnumUnspecified: return 0
      case .sparseA: return 123
      case .sparseB: return 62374
      case .sparseC: return 12589234
      case .sparseD: return -15
      case .sparseE: return -53452
      case .sparseG: return 2
      case .UNRECOGNIZED(let i): return i
      }
    }
  }

  var json: String {
    get {
      switch self {
      case .testSparseEnumUnspecified: return "\"TEST_SPARSE_ENUM_UNSPECIFIED\""
      case .sparseA: return "\"SPARSE_A\""
      case .sparseB: return "\"SPARSE_B\""
      case .sparseC: return "\"SPARSE_C\""
      case .sparseD: return "\"SPARSE_D\""
      case .sparseE: return "\"SPARSE_E\""
      case .sparseG: return "\"SPARSE_G\""
      case .UNRECOGNIZED(let i): return String(i)
      }
    }
  }

  var hashValue: Int { return rawValue }

  var debugDescription: String {
    get {
      switch self {
      case .testSparseEnumUnspecified: return ".testSparseEnumUnspecified"
      case .sparseA: return ".sparseA"
      case .sparseB: return ".sparseB"
      case .sparseC: return ".sparseC"
      case .sparseD: return ".sparseD"
      case .sparseE: return ".sparseE"
      case .sparseG: return ".sparseG"
      case .UNRECOGNIZED(let v): return ".UNRECOGNIZED(\(v))"
      }
    }
  }

}

///   This proto includes every type of field in both singular and repeated
///   forms.
struct Proto3TestAllTypes: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestAllTypes"}
  public var protoMessageName: String {return "TestAllTypes"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .unique(proto: "single_int32", json: "singleInt32", swift: "singleInt32"),
    2: .unique(proto: "single_int64", json: "singleInt64", swift: "singleInt64"),
    3: .unique(proto: "single_uint32", json: "singleUint32", swift: "singleUint32"),
    4: .unique(proto: "single_uint64", json: "singleUint64", swift: "singleUint64"),
    5: .unique(proto: "single_sint32", json: "singleSint32", swift: "singleSint32"),
    6: .unique(proto: "single_sint64", json: "singleSint64", swift: "singleSint64"),
    7: .unique(proto: "single_fixed32", json: "singleFixed32", swift: "singleFixed32"),
    8: .unique(proto: "single_fixed64", json: "singleFixed64", swift: "singleFixed64"),
    9: .unique(proto: "single_sfixed32", json: "singleSfixed32", swift: "singleSfixed32"),
    10: .unique(proto: "single_sfixed64", json: "singleSfixed64", swift: "singleSfixed64"),
    11: .unique(proto: "single_float", json: "singleFloat", swift: "singleFloat"),
    12: .unique(proto: "single_double", json: "singleDouble", swift: "singleDouble"),
    13: .unique(proto: "single_bool", json: "singleBool", swift: "singleBool"),
    14: .unique(proto: "single_string", json: "singleString", swift: "singleString"),
    15: .unique(proto: "single_bytes", json: "singleBytes", swift: "singleBytes"),
    18: .unique(proto: "single_nested_message", json: "singleNestedMessage", swift: "singleNestedMessage"),
    19: .unique(proto: "single_foreign_message", json: "singleForeignMessage", swift: "singleForeignMessage"),
    20: .unique(proto: "single_import_message", json: "singleImportMessage", swift: "singleImportMessage"),
    21: .unique(proto: "single_nested_enum", json: "singleNestedEnum", swift: "singleNestedEnum"),
    22: .unique(proto: "single_foreign_enum", json: "singleForeignEnum", swift: "singleForeignEnum"),
    23: .unique(proto: "single_import_enum", json: "singleImportEnum", swift: "singleImportEnum"),
    26: .unique(proto: "single_public_import_message", json: "singlePublicImportMessage", swift: "singlePublicImportMessage"),
    31: .unique(proto: "repeated_int32", json: "repeatedInt32", swift: "repeatedInt32"),
    32: .unique(proto: "repeated_int64", json: "repeatedInt64", swift: "repeatedInt64"),
    33: .unique(proto: "repeated_uint32", json: "repeatedUint32", swift: "repeatedUint32"),
    34: .unique(proto: "repeated_uint64", json: "repeatedUint64", swift: "repeatedUint64"),
    35: .unique(proto: "repeated_sint32", json: "repeatedSint32", swift: "repeatedSint32"),
    36: .unique(proto: "repeated_sint64", json: "repeatedSint64", swift: "repeatedSint64"),
    37: .unique(proto: "repeated_fixed32", json: "repeatedFixed32", swift: "repeatedFixed32"),
    38: .unique(proto: "repeated_fixed64", json: "repeatedFixed64", swift: "repeatedFixed64"),
    39: .unique(proto: "repeated_sfixed32", json: "repeatedSfixed32", swift: "repeatedSfixed32"),
    40: .unique(proto: "repeated_sfixed64", json: "repeatedSfixed64", swift: "repeatedSfixed64"),
    41: .unique(proto: "repeated_float", json: "repeatedFloat", swift: "repeatedFloat"),
    42: .unique(proto: "repeated_double", json: "repeatedDouble", swift: "repeatedDouble"),
    43: .unique(proto: "repeated_bool", json: "repeatedBool", swift: "repeatedBool"),
    44: .unique(proto: "repeated_string", json: "repeatedString", swift: "repeatedString"),
    45: .unique(proto: "repeated_bytes", json: "repeatedBytes", swift: "repeatedBytes"),
    48: .unique(proto: "repeated_nested_message", json: "repeatedNestedMessage", swift: "repeatedNestedMessage"),
    49: .unique(proto: "repeated_foreign_message", json: "repeatedForeignMessage", swift: "repeatedForeignMessage"),
    50: .unique(proto: "repeated_import_message", json: "repeatedImportMessage", swift: "repeatedImportMessage"),
    51: .unique(proto: "repeated_nested_enum", json: "repeatedNestedEnum", swift: "repeatedNestedEnum"),
    52: .unique(proto: "repeated_foreign_enum", json: "repeatedForeignEnum", swift: "repeatedForeignEnum"),
    53: .unique(proto: "repeated_import_enum", json: "repeatedImportEnum", swift: "repeatedImportEnum"),
    54: .unique(proto: "repeated_public_import_message", json: "repeatedPublicImportMessage", swift: "repeatedPublicImportMessage"),
    111: .unique(proto: "oneof_uint32", json: "oneofUint32", swift: "oneofUint32"),
    112: .unique(proto: "oneof_nested_message", json: "oneofNestedMessage", swift: "oneofNestedMessage"),
    113: .unique(proto: "oneof_string", json: "oneofString", swift: "oneofString"),
    114: .unique(proto: "oneof_bytes", json: "oneofBytes", swift: "oneofBytes"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestAllTypes
    var _singleInt32: Int32 = 0
    var _singleInt64: Int64 = 0
    var _singleUint32: UInt32 = 0
    var _singleUint64: UInt64 = 0
    var _singleSint32: Int32 = 0
    var _singleSint64: Int64 = 0
    var _singleFixed32: UInt32 = 0
    var _singleFixed64: UInt64 = 0
    var _singleSfixed32: Int32 = 0
    var _singleSfixed64: Int64 = 0
    var _singleFloat: Float = 0
    var _singleDouble: Double = 0
    var _singleBool: Bool = false
    var _singleString: String = ""
    var _singleBytes: Data = Data()
    var _singleNestedMessage: Proto3TestAllTypes.NestedMessage? = nil
    var _singleForeignMessage: Proto3ForeignMessage? = nil
    var _singleImportMessage: Proto3ImportMessage? = nil
    var _singleNestedEnum: Proto3TestAllTypes.NestedEnum = Proto3TestAllTypes.NestedEnum.nestedEnumUnspecified
    var _singleForeignEnum: Proto3ForeignEnum = Proto3ForeignEnum.foreignUnspecified
    var _singleImportEnum: Proto3ImportEnum = Proto3ImportEnum.importEnumUnspecified
    var _singlePublicImportMessage: Proto3PublicImportMessage? = nil
    var _repeatedInt32: [Int32] = []
    var _repeatedInt64: [Int64] = []
    var _repeatedUint32: [UInt32] = []
    var _repeatedUint64: [UInt64] = []
    var _repeatedSint32: [Int32] = []
    var _repeatedSint64: [Int64] = []
    var _repeatedFixed32: [UInt32] = []
    var _repeatedFixed64: [UInt64] = []
    var _repeatedSfixed32: [Int32] = []
    var _repeatedSfixed64: [Int64] = []
    var _repeatedFloat: [Float] = []
    var _repeatedDouble: [Double] = []
    var _repeatedBool: [Bool] = []
    var _repeatedString: [String] = []
    var _repeatedBytes: [Data] = []
    var _repeatedNestedMessage: [Proto3TestAllTypes.NestedMessage] = []
    var _repeatedForeignMessage: [Proto3ForeignMessage] = []
    var _repeatedImportMessage: [Proto3ImportMessage] = []
    var _repeatedNestedEnum: [Proto3TestAllTypes.NestedEnum] = []
    var _repeatedForeignEnum: [Proto3ForeignEnum] = []
    var _repeatedImportEnum: [Proto3ImportEnum] = []
    var _repeatedPublicImportMessage: [Proto3PublicImportMessage] = []
    var _oneofField = Proto3TestAllTypes.OneOf_OneofField()

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &_singleInt32)
      case 2: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &_singleInt64)
      case 3: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: &_singleUint32)
      case 4: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: &_singleUint64)
      case 5: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: &_singleSint32)
      case 6: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: &_singleSint64)
      case 7: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: &_singleFixed32)
      case 8: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: &_singleFixed64)
      case 9: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: &_singleSfixed32)
      case 10: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: &_singleSfixed64)
      case 11: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: &_singleFloat)
      case 12: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: &_singleDouble)
      case 13: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufBool.self, value: &_singleBool)
      case 14: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: &_singleString)
      case 15: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: &_singleBytes)
      case 18: try setter.decodeSingularMessageField(fieldType: Proto3TestAllTypes.NestedMessage.self, value: &_singleNestedMessage)
      case 19: try setter.decodeSingularMessageField(fieldType: Proto3ForeignMessage.self, value: &_singleForeignMessage)
      case 20: try setter.decodeSingularMessageField(fieldType: Proto3ImportMessage.self, value: &_singleImportMessage)
      case 21: try setter.decodeSingularField(fieldType: Proto3TestAllTypes.NestedEnum.self, value: &_singleNestedEnum)
      case 22: try setter.decodeSingularField(fieldType: Proto3ForeignEnum.self, value: &_singleForeignEnum)
      case 23: try setter.decodeSingularField(fieldType: Proto3ImportEnum.self, value: &_singleImportEnum)
      case 26: try setter.decodeSingularMessageField(fieldType: Proto3PublicImportMessage.self, value: &_singlePublicImportMessage)
      case 31: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &_repeatedInt32)
      case 32: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &_repeatedInt64)
      case 33: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: &_repeatedUint32)
      case 34: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: &_repeatedUint64)
      case 35: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: &_repeatedSint32)
      case 36: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: &_repeatedSint64)
      case 37: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: &_repeatedFixed32)
      case 38: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: &_repeatedFixed64)
      case 39: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: &_repeatedSfixed32)
      case 40: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: &_repeatedSfixed64)
      case 41: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: &_repeatedFloat)
      case 42: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: &_repeatedDouble)
      case 43: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufBool.self, value: &_repeatedBool)
      case 44: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufString.self, value: &_repeatedString)
      case 45: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: &_repeatedBytes)
      case 48: try setter.decodeRepeatedMessageField(fieldType: Proto3TestAllTypes.NestedMessage.self, value: &_repeatedNestedMessage)
      case 49: try setter.decodeRepeatedMessageField(fieldType: Proto3ForeignMessage.self, value: &_repeatedForeignMessage)
      case 50: try setter.decodeRepeatedMessageField(fieldType: Proto3ImportMessage.self, value: &_repeatedImportMessage)
      case 51: try setter.decodePackedField(fieldType: Proto3TestAllTypes.NestedEnum.self, value: &_repeatedNestedEnum)
      case 52: try setter.decodePackedField(fieldType: Proto3ForeignEnum.self, value: &_repeatedForeignEnum)
      case 53: try setter.decodePackedField(fieldType: Proto3ImportEnum.self, value: &_repeatedImportEnum)
      case 54: try setter.decodeRepeatedMessageField(fieldType: Proto3PublicImportMessage.self, value: &_repeatedPublicImportMessage)
      case 111, 112, 113, 114: try _oneofField.decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if _singleInt32 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: _singleInt32, protoFieldNumber: 1)
      }
      if _singleInt64 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: _singleInt64, protoFieldNumber: 2)
      }
      if _singleUint32 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: _singleUint32, protoFieldNumber: 3)
      }
      if _singleUint64 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: _singleUint64, protoFieldNumber: 4)
      }
      if _singleSint32 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: _singleSint32, protoFieldNumber: 5)
      }
      if _singleSint64 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: _singleSint64, protoFieldNumber: 6)
      }
      if _singleFixed32 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: _singleFixed32, protoFieldNumber: 7)
      }
      if _singleFixed64 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: _singleFixed64, protoFieldNumber: 8)
      }
      if _singleSfixed32 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: _singleSfixed32, protoFieldNumber: 9)
      }
      if _singleSfixed64 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: _singleSfixed64, protoFieldNumber: 10)
      }
      if _singleFloat != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: _singleFloat, protoFieldNumber: 11)
      }
      if _singleDouble != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: _singleDouble, protoFieldNumber: 12)
      }
      if _singleBool != false {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufBool.self, value: _singleBool, protoFieldNumber: 13)
      }
      if _singleString != "" {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: _singleString, protoFieldNumber: 14)
      }
      if _singleBytes != Data() {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: _singleBytes, protoFieldNumber: 15)
      }
      if let v = _singleNestedMessage {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 18)
      }
      if let v = _singleForeignMessage {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 19)
      }
      if let v = _singleImportMessage {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 20)
      }
      if _singleNestedEnum != Proto3TestAllTypes.NestedEnum.nestedEnumUnspecified {
        try visitor.visitSingularField(fieldType: Proto3TestAllTypes.NestedEnum.self, value: _singleNestedEnum, protoFieldNumber: 21)
      }
      if _singleForeignEnum != Proto3ForeignEnum.foreignUnspecified {
        try visitor.visitSingularField(fieldType: Proto3ForeignEnum.self, value: _singleForeignEnum, protoFieldNumber: 22)
      }
      if _singleImportEnum != Proto3ImportEnum.importEnumUnspecified {
        try visitor.visitSingularField(fieldType: Proto3ImportEnum.self, value: _singleImportEnum, protoFieldNumber: 23)
      }
      if let v = _singlePublicImportMessage {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 26)
      }
      if !_repeatedInt32.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: _repeatedInt32, protoFieldNumber: 31)
      }
      if !_repeatedInt64.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: _repeatedInt64, protoFieldNumber: 32)
      }
      if !_repeatedUint32.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: _repeatedUint32, protoFieldNumber: 33)
      }
      if !_repeatedUint64.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: _repeatedUint64, protoFieldNumber: 34)
      }
      if !_repeatedSint32.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: _repeatedSint32, protoFieldNumber: 35)
      }
      if !_repeatedSint64.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: _repeatedSint64, protoFieldNumber: 36)
      }
      if !_repeatedFixed32.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: _repeatedFixed32, protoFieldNumber: 37)
      }
      if !_repeatedFixed64.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: _repeatedFixed64, protoFieldNumber: 38)
      }
      if !_repeatedSfixed32.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: _repeatedSfixed32, protoFieldNumber: 39)
      }
      if !_repeatedSfixed64.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: _repeatedSfixed64, protoFieldNumber: 40)
      }
      if !_repeatedFloat.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: _repeatedFloat, protoFieldNumber: 41)
      }
      if !_repeatedDouble.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: _repeatedDouble, protoFieldNumber: 42)
      }
      if !_repeatedBool.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufBool.self, value: _repeatedBool, protoFieldNumber: 43)
      }
      if !_repeatedString.isEmpty {
        try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufString.self, value: _repeatedString, protoFieldNumber: 44)
      }
      if !_repeatedBytes.isEmpty {
        try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: _repeatedBytes, protoFieldNumber: 45)
      }
      if !_repeatedNestedMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _repeatedNestedMessage, protoFieldNumber: 48)
      }
      if !_repeatedForeignMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _repeatedForeignMessage, protoFieldNumber: 49)
      }
      if !_repeatedImportMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _repeatedImportMessage, protoFieldNumber: 50)
      }
      if !_repeatedNestedEnum.isEmpty {
        try visitor.visitPackedField(fieldType: Proto3TestAllTypes.NestedEnum.self, value: _repeatedNestedEnum, protoFieldNumber: 51)
      }
      if !_repeatedForeignEnum.isEmpty {
        try visitor.visitPackedField(fieldType: Proto3ForeignEnum.self, value: _repeatedForeignEnum, protoFieldNumber: 52)
      }
      if !_repeatedImportEnum.isEmpty {
        try visitor.visitPackedField(fieldType: Proto3ImportEnum.self, value: _repeatedImportEnum, protoFieldNumber: 53)
      }
      if !_repeatedPublicImportMessage.isEmpty {
        try visitor.visitRepeatedMessageField(value: _repeatedPublicImportMessage, protoFieldNumber: 54)
      }
      try _oneofField.traverse(visitor: &visitor, start: 111, end: 115)
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _singleInt32 != other._singleInt32 {return false}
      if _singleInt64 != other._singleInt64 {return false}
      if _singleUint32 != other._singleUint32 {return false}
      if _singleUint64 != other._singleUint64 {return false}
      if _singleSint32 != other._singleSint32 {return false}
      if _singleSint64 != other._singleSint64 {return false}
      if _singleFixed32 != other._singleFixed32 {return false}
      if _singleFixed64 != other._singleFixed64 {return false}
      if _singleSfixed32 != other._singleSfixed32 {return false}
      if _singleSfixed64 != other._singleSfixed64 {return false}
      if _singleFloat != other._singleFloat {return false}
      if _singleDouble != other._singleDouble {return false}
      if _singleBool != other._singleBool {return false}
      if _singleString != other._singleString {return false}
      if _singleBytes != other._singleBytes {return false}
      if _singleNestedMessage != other._singleNestedMessage {return false}
      if _singleForeignMessage != other._singleForeignMessage {return false}
      if _singleImportMessage != other._singleImportMessage {return false}
      if _singleNestedEnum != other._singleNestedEnum {return false}
      if _singleForeignEnum != other._singleForeignEnum {return false}
      if _singleImportEnum != other._singleImportEnum {return false}
      if _singlePublicImportMessage != other._singlePublicImportMessage {return false}
      if _repeatedInt32 != other._repeatedInt32 {return false}
      if _repeatedInt64 != other._repeatedInt64 {return false}
      if _repeatedUint32 != other._repeatedUint32 {return false}
      if _repeatedUint64 != other._repeatedUint64 {return false}
      if _repeatedSint32 != other._repeatedSint32 {return false}
      if _repeatedSint64 != other._repeatedSint64 {return false}
      if _repeatedFixed32 != other._repeatedFixed32 {return false}
      if _repeatedFixed64 != other._repeatedFixed64 {return false}
      if _repeatedSfixed32 != other._repeatedSfixed32 {return false}
      if _repeatedSfixed64 != other._repeatedSfixed64 {return false}
      if _repeatedFloat != other._repeatedFloat {return false}
      if _repeatedDouble != other._repeatedDouble {return false}
      if _repeatedBool != other._repeatedBool {return false}
      if _repeatedString != other._repeatedString {return false}
      if _repeatedBytes != other._repeatedBytes {return false}
      if _repeatedNestedMessage != other._repeatedNestedMessage {return false}
      if _repeatedForeignMessage != other._repeatedForeignMessage {return false}
      if _repeatedImportMessage != other._repeatedImportMessage {return false}
      if _repeatedNestedEnum != other._repeatedNestedEnum {return false}
      if _repeatedForeignEnum != other._repeatedForeignEnum {return false}
      if _repeatedImportEnum != other._repeatedImportEnum {return false}
      if _repeatedPublicImportMessage != other._repeatedPublicImportMessage {return false}
      if _oneofField != other._oneofField {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._singleInt32 = _singleInt32
      clone._singleInt64 = _singleInt64
      clone._singleUint32 = _singleUint32
      clone._singleUint64 = _singleUint64
      clone._singleSint32 = _singleSint32
      clone._singleSint64 = _singleSint64
      clone._singleFixed32 = _singleFixed32
      clone._singleFixed64 = _singleFixed64
      clone._singleSfixed32 = _singleSfixed32
      clone._singleSfixed64 = _singleSfixed64
      clone._singleFloat = _singleFloat
      clone._singleDouble = _singleDouble
      clone._singleBool = _singleBool
      clone._singleString = _singleString
      clone._singleBytes = _singleBytes
      clone._singleNestedMessage = _singleNestedMessage
      clone._singleForeignMessage = _singleForeignMessage
      clone._singleImportMessage = _singleImportMessage
      clone._singleNestedEnum = _singleNestedEnum
      clone._singleForeignEnum = _singleForeignEnum
      clone._singleImportEnum = _singleImportEnum
      clone._singlePublicImportMessage = _singlePublicImportMessage
      clone._repeatedInt32 = _repeatedInt32
      clone._repeatedInt64 = _repeatedInt64
      clone._repeatedUint32 = _repeatedUint32
      clone._repeatedUint64 = _repeatedUint64
      clone._repeatedSint32 = _repeatedSint32
      clone._repeatedSint64 = _repeatedSint64
      clone._repeatedFixed32 = _repeatedFixed32
      clone._repeatedFixed64 = _repeatedFixed64
      clone._repeatedSfixed32 = _repeatedSfixed32
      clone._repeatedSfixed64 = _repeatedSfixed64
      clone._repeatedFloat = _repeatedFloat
      clone._repeatedDouble = _repeatedDouble
      clone._repeatedBool = _repeatedBool
      clone._repeatedString = _repeatedString
      clone._repeatedBytes = _repeatedBytes
      clone._repeatedNestedMessage = _repeatedNestedMessage
      clone._repeatedForeignMessage = _repeatedForeignMessage
      clone._repeatedImportMessage = _repeatedImportMessage
      clone._repeatedNestedEnum = _repeatedNestedEnum
      clone._repeatedForeignEnum = _repeatedForeignEnum
      clone._repeatedImportEnum = _repeatedImportEnum
      clone._repeatedPublicImportMessage = _repeatedPublicImportMessage
      clone._oneofField = _oneofField
      return clone
    }
  }

  private var _storage = _StorageClass()


  enum OneOf_OneofField: ExpressibleByNilLiteral, SwiftProtobuf.OneofEnum {
    case oneofUint32(UInt32)
    case oneofNestedMessage(Proto3TestAllTypes.NestedMessage)
    case oneofString(String)
    case oneofBytes(Data)
    case None

    public init(nilLiteral: ()) {
      self = .None
    }

    public init() {
      self = .None
    }

    public mutating func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      if self != .None && setter.rejectConflictingOneof {
        throw SwiftProtobuf.DecodingError.duplicatedOneOf
      }
      switch protoFieldNumber {
      case 111:
        var value = UInt32()
        try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: &value)
        self = .oneofUint32(value)
      case 112:
        var value: Proto3TestAllTypes.NestedMessage?
        try setter.decodeSingularMessageField(fieldType: Proto3TestAllTypes.NestedMessage.self, value: &value)
        if let value = value {
          self = .oneofNestedMessage(value)
        }
      case 113:
        var value = String()
        try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: &value)
        self = .oneofString(value)
      case 114:
        var value = Data()
        try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: &value)
        self = .oneofBytes(value)
      default:
        self = .None
      }
    }

    public func traverse(visitor: inout SwiftProtobuf.Visitor, start: Int, end: Int) throws {
      switch self {
      case .oneofUint32(let v):
        if start <= 111 && 111 < end {
          try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: v, protoFieldNumber: 111)
        }
      case .oneofNestedMessage(let v):
        if start <= 112 && 112 < end {
          try visitor.visitSingularMessageField(value: v, protoFieldNumber: 112)
        }
      case .oneofString(let v):
        if start <= 113 && 113 < end {
          try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: v, protoFieldNumber: 113)
        }
      case .oneofBytes(let v):
        if start <= 114 && 114 < end {
          try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: v, protoFieldNumber: 114)
        }
      case .None:
        break
      }
    }
  }

  enum NestedEnum: SwiftProtobuf.Enum {
    typealias RawValue = Int
    case nestedEnumUnspecified // = 0
    case foo // = 1
    case bar // = 2
    case baz // = 3

    ///   Intentionally negative.
    case neg // = -1
    case UNRECOGNIZED(Int)

    init() {
      self = .nestedEnumUnspecified
    }

    init?(rawValue: Int) {
      switch rawValue {
      case 0: self = .nestedEnumUnspecified
      case 1: self = .foo
      case 2: self = .bar
      case 3: self = .baz
      case -1: self = .neg
      default: self = .UNRECOGNIZED(rawValue)
      }
    }

    init?(name: String) {
      switch name {
      case "nestedEnumUnspecified": self = .nestedEnumUnspecified
      case "foo": self = .foo
      case "bar": self = .bar
      case "baz": self = .baz
      case "neg": self = .neg
      default: return nil
      }
    }

    init?(jsonName: String) {
      switch jsonName {
      case "NESTED_ENUM_UNSPECIFIED": self = .nestedEnumUnspecified
      case "FOO": self = .foo
      case "BAR": self = .bar
      case "BAZ": self = .baz
      case "NEG": self = .neg
      default: return nil
      }
    }

    init?(protoName: String) {
      switch protoName {
      case "NESTED_ENUM_UNSPECIFIED": self = .nestedEnumUnspecified
      case "FOO": self = .foo
      case "BAR": self = .bar
      case "BAZ": self = .baz
      case "NEG": self = .neg
      default: return nil
      }
    }

    var rawValue: Int {
      get {
        switch self {
        case .nestedEnumUnspecified: return 0
        case .foo: return 1
        case .bar: return 2
        case .baz: return 3
        case .neg: return -1
        case .UNRECOGNIZED(let i): return i
        }
      }
    }

    var json: String {
      get {
        switch self {
        case .nestedEnumUnspecified: return "\"NESTED_ENUM_UNSPECIFIED\""
        case .foo: return "\"FOO\""
        case .bar: return "\"BAR\""
        case .baz: return "\"BAZ\""
        case .neg: return "\"NEG\""
        case .UNRECOGNIZED(let i): return String(i)
        }
      }
    }

    var hashValue: Int { return rawValue }

    var debugDescription: String {
      get {
        switch self {
        case .nestedEnumUnspecified: return ".nestedEnumUnspecified"
        case .foo: return ".foo"
        case .bar: return ".bar"
        case .baz: return ".baz"
        case .neg: return ".neg"
        case .UNRECOGNIZED(let v): return ".UNRECOGNIZED(\(v))"
        }
      }
    }

  }

  struct NestedMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
    public var swiftClassName: String {return "Proto3TestAllTypes.NestedMessage"}
    public var protoMessageName: String {return "NestedMessage"}
    public var protoPackageName: String {return "protobuf_unittest"}
    public static let _protobuf_fieldNames: FieldNameMap = [
      1: .same(proto: "bb", swift: "bb"),
    ]


    ///   The field name "b" fails to compile in proto1 because it conflicts with
    ///   a local variable named "b" in one of the generated methods.  Doh.
    ///   This file needs to compile in proto1 to test backwards-compatibility.
    var bb: Int32 = 0

    init() {}

    public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &bb)
      default: break
      }
    }

    public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if bb != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: bb, protoFieldNumber: 1)
      }
    }

    public func _protoc_generated_isEqualTo(other: Proto3TestAllTypes.NestedMessage) -> Bool {
      if bb != other.bb {return false}
      return true
    }
  }

  ///   Singular
  var singleInt32: Int32 {
    get {return _storage._singleInt32}
    set {_uniqueStorage()._singleInt32 = newValue}
  }

  var singleInt64: Int64 {
    get {return _storage._singleInt64}
    set {_uniqueStorage()._singleInt64 = newValue}
  }

  var singleUint32: UInt32 {
    get {return _storage._singleUint32}
    set {_uniqueStorage()._singleUint32 = newValue}
  }

  var singleUint64: UInt64 {
    get {return _storage._singleUint64}
    set {_uniqueStorage()._singleUint64 = newValue}
  }

  var singleSint32: Int32 {
    get {return _storage._singleSint32}
    set {_uniqueStorage()._singleSint32 = newValue}
  }

  var singleSint64: Int64 {
    get {return _storage._singleSint64}
    set {_uniqueStorage()._singleSint64 = newValue}
  }

  var singleFixed32: UInt32 {
    get {return _storage._singleFixed32}
    set {_uniqueStorage()._singleFixed32 = newValue}
  }

  var singleFixed64: UInt64 {
    get {return _storage._singleFixed64}
    set {_uniqueStorage()._singleFixed64 = newValue}
  }

  var singleSfixed32: Int32 {
    get {return _storage._singleSfixed32}
    set {_uniqueStorage()._singleSfixed32 = newValue}
  }

  var singleSfixed64: Int64 {
    get {return _storage._singleSfixed64}
    set {_uniqueStorage()._singleSfixed64 = newValue}
  }

  var singleFloat: Float {
    get {return _storage._singleFloat}
    set {_uniqueStorage()._singleFloat = newValue}
  }

  var singleDouble: Double {
    get {return _storage._singleDouble}
    set {_uniqueStorage()._singleDouble = newValue}
  }

  var singleBool: Bool {
    get {return _storage._singleBool}
    set {_uniqueStorage()._singleBool = newValue}
  }

  var singleString: String {
    get {return _storage._singleString}
    set {_uniqueStorage()._singleString = newValue}
  }

  var singleBytes: Data {
    get {return _storage._singleBytes}
    set {_uniqueStorage()._singleBytes = newValue}
  }

  var singleNestedMessage: Proto3TestAllTypes.NestedMessage {
    get {return _storage._singleNestedMessage ?? Proto3TestAllTypes.NestedMessage()}
    set {_uniqueStorage()._singleNestedMessage = newValue}
  }
  public var hasSingleNestedMessage: Bool {
    return _storage._singleNestedMessage != nil
  }
  public mutating func clearSingleNestedMessage() {
    return _storage._singleNestedMessage = nil
  }

  var singleForeignMessage: Proto3ForeignMessage {
    get {return _storage._singleForeignMessage ?? Proto3ForeignMessage()}
    set {_uniqueStorage()._singleForeignMessage = newValue}
  }
  public var hasSingleForeignMessage: Bool {
    return _storage._singleForeignMessage != nil
  }
  public mutating func clearSingleForeignMessage() {
    return _storage._singleForeignMessage = nil
  }

  var singleImportMessage: Proto3ImportMessage {
    get {return _storage._singleImportMessage ?? Proto3ImportMessage()}
    set {_uniqueStorage()._singleImportMessage = newValue}
  }
  public var hasSingleImportMessage: Bool {
    return _storage._singleImportMessage != nil
  }
  public mutating func clearSingleImportMessage() {
    return _storage._singleImportMessage = nil
  }

  var singleNestedEnum: Proto3TestAllTypes.NestedEnum {
    get {return _storage._singleNestedEnum}
    set {_uniqueStorage()._singleNestedEnum = newValue}
  }

  var singleForeignEnum: Proto3ForeignEnum {
    get {return _storage._singleForeignEnum}
    set {_uniqueStorage()._singleForeignEnum = newValue}
  }

  var singleImportEnum: Proto3ImportEnum {
    get {return _storage._singleImportEnum}
    set {_uniqueStorage()._singleImportEnum = newValue}
  }

  ///   Defined in unittest_import_public.proto
  var singlePublicImportMessage: Proto3PublicImportMessage {
    get {return _storage._singlePublicImportMessage ?? Proto3PublicImportMessage()}
    set {_uniqueStorage()._singlePublicImportMessage = newValue}
  }
  public var hasSinglePublicImportMessage: Bool {
    return _storage._singlePublicImportMessage != nil
  }
  public mutating func clearSinglePublicImportMessage() {
    return _storage._singlePublicImportMessage = nil
  }

  ///   Repeated
  var repeatedInt32: [Int32] {
    get {return _storage._repeatedInt32}
    set {_uniqueStorage()._repeatedInt32 = newValue}
  }

  var repeatedInt64: [Int64] {
    get {return _storage._repeatedInt64}
    set {_uniqueStorage()._repeatedInt64 = newValue}
  }

  var repeatedUint32: [UInt32] {
    get {return _storage._repeatedUint32}
    set {_uniqueStorage()._repeatedUint32 = newValue}
  }

  var repeatedUint64: [UInt64] {
    get {return _storage._repeatedUint64}
    set {_uniqueStorage()._repeatedUint64 = newValue}
  }

  var repeatedSint32: [Int32] {
    get {return _storage._repeatedSint32}
    set {_uniqueStorage()._repeatedSint32 = newValue}
  }

  var repeatedSint64: [Int64] {
    get {return _storage._repeatedSint64}
    set {_uniqueStorage()._repeatedSint64 = newValue}
  }

  var repeatedFixed32: [UInt32] {
    get {return _storage._repeatedFixed32}
    set {_uniqueStorage()._repeatedFixed32 = newValue}
  }

  var repeatedFixed64: [UInt64] {
    get {return _storage._repeatedFixed64}
    set {_uniqueStorage()._repeatedFixed64 = newValue}
  }

  var repeatedSfixed32: [Int32] {
    get {return _storage._repeatedSfixed32}
    set {_uniqueStorage()._repeatedSfixed32 = newValue}
  }

  var repeatedSfixed64: [Int64] {
    get {return _storage._repeatedSfixed64}
    set {_uniqueStorage()._repeatedSfixed64 = newValue}
  }

  var repeatedFloat: [Float] {
    get {return _storage._repeatedFloat}
    set {_uniqueStorage()._repeatedFloat = newValue}
  }

  var repeatedDouble: [Double] {
    get {return _storage._repeatedDouble}
    set {_uniqueStorage()._repeatedDouble = newValue}
  }

  var repeatedBool: [Bool] {
    get {return _storage._repeatedBool}
    set {_uniqueStorage()._repeatedBool = newValue}
  }

  var repeatedString: [String] {
    get {return _storage._repeatedString}
    set {_uniqueStorage()._repeatedString = newValue}
  }

  var repeatedBytes: [Data] {
    get {return _storage._repeatedBytes}
    set {_uniqueStorage()._repeatedBytes = newValue}
  }

  var repeatedNestedMessage: [Proto3TestAllTypes.NestedMessage] {
    get {return _storage._repeatedNestedMessage}
    set {_uniqueStorage()._repeatedNestedMessage = newValue}
  }

  var repeatedForeignMessage: [Proto3ForeignMessage] {
    get {return _storage._repeatedForeignMessage}
    set {_uniqueStorage()._repeatedForeignMessage = newValue}
  }

  var repeatedImportMessage: [Proto3ImportMessage] {
    get {return _storage._repeatedImportMessage}
    set {_uniqueStorage()._repeatedImportMessage = newValue}
  }

  var repeatedNestedEnum: [Proto3TestAllTypes.NestedEnum] {
    get {return _storage._repeatedNestedEnum}
    set {_uniqueStorage()._repeatedNestedEnum = newValue}
  }

  var repeatedForeignEnum: [Proto3ForeignEnum] {
    get {return _storage._repeatedForeignEnum}
    set {_uniqueStorage()._repeatedForeignEnum = newValue}
  }

  var repeatedImportEnum: [Proto3ImportEnum] {
    get {return _storage._repeatedImportEnum}
    set {_uniqueStorage()._repeatedImportEnum = newValue}
  }

  ///   Defined in unittest_import_public.proto
  var repeatedPublicImportMessage: [Proto3PublicImportMessage] {
    get {return _storage._repeatedPublicImportMessage}
    set {_uniqueStorage()._repeatedPublicImportMessage = newValue}
  }

  var oneofUint32: UInt32 {
    get {
      if case .oneofUint32(let v) = _storage._oneofField {
        return v
      }
      return 0
    }
    set {
      _uniqueStorage()._oneofField = .oneofUint32(newValue)
    }
  }

  var oneofNestedMessage: Proto3TestAllTypes.NestedMessage {
    get {
      if case .oneofNestedMessage(let v) = _storage._oneofField {
        return v
      }
      return Proto3TestAllTypes.NestedMessage()
    }
    set {
      _uniqueStorage()._oneofField = .oneofNestedMessage(newValue)
    }
  }

  var oneofString: String {
    get {
      if case .oneofString(let v) = _storage._oneofField {
        return v
      }
      return ""
    }
    set {
      _uniqueStorage()._oneofField = .oneofString(newValue)
    }
  }

  var oneofBytes: Data {
    get {
      if case .oneofBytes(let v) = _storage._oneofField {
        return v
      }
      return Data()
    }
    set {
      _uniqueStorage()._oneofField = .oneofBytes(newValue)
    }
  }

  public var oneofField: OneOf_OneofField {
    get {return _storage._oneofField}
    set {
      _uniqueStorage()._oneofField = newValue
    }
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestAllTypes) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

///   This proto includes a recusively nested message.
struct Proto3NestedTestAllTypes: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3NestedTestAllTypes"}
  public var protoMessageName: String {return "NestedTestAllTypes"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "child", swift: "child"),
    2: .same(proto: "payload", swift: "payload"),
    3: .unique(proto: "repeated_child", json: "repeatedChild", swift: "repeatedChild"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3NestedTestAllTypes
    var _child: Proto3NestedTestAllTypes? = nil
    var _payload: Proto3TestAllTypes? = nil
    var _repeatedChild: [Proto3NestedTestAllTypes] = []

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularMessageField(fieldType: Proto3NestedTestAllTypes.self, value: &_child)
      case 2: try setter.decodeSingularMessageField(fieldType: Proto3TestAllTypes.self, value: &_payload)
      case 3: try setter.decodeRepeatedMessageField(fieldType: Proto3NestedTestAllTypes.self, value: &_repeatedChild)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if let v = _child {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 1)
      }
      if let v = _payload {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 2)
      }
      if !_repeatedChild.isEmpty {
        try visitor.visitRepeatedMessageField(value: _repeatedChild, protoFieldNumber: 3)
      }
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _child != other._child {return false}
      if _payload != other._payload {return false}
      if _repeatedChild != other._repeatedChild {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._child = _child
      clone._payload = _payload
      clone._repeatedChild = _repeatedChild
      return clone
    }
  }

  private var _storage = _StorageClass()


  var child: Proto3NestedTestAllTypes {
    get {return _storage._child ?? Proto3NestedTestAllTypes()}
    set {_uniqueStorage()._child = newValue}
  }
  public var hasChild: Bool {
    return _storage._child != nil
  }
  public mutating func clearChild() {
    return _storage._child = nil
  }

  var payload: Proto3TestAllTypes {
    get {return _storage._payload ?? Proto3TestAllTypes()}
    set {_uniqueStorage()._payload = newValue}
  }
  public var hasPayload: Bool {
    return _storage._payload != nil
  }
  public mutating func clearPayload() {
    return _storage._payload = nil
  }

  var repeatedChild: [Proto3NestedTestAllTypes] {
    get {return _storage._repeatedChild}
    set {_uniqueStorage()._repeatedChild = newValue}
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3NestedTestAllTypes) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

struct Proto3TestDeprecatedFields: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestDeprecatedFields"}
  public var protoMessageName: String {return "TestDeprecatedFields"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .unique(proto: "deprecated_int32", json: "deprecatedInt32", swift: "deprecatedInt32"),
  ]


  var deprecatedInt32: Int32 = 0

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &deprecatedInt32)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if deprecatedInt32 != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: deprecatedInt32, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestDeprecatedFields) -> Bool {
    if deprecatedInt32 != other.deprecatedInt32 {return false}
    return true
  }
}

///   Define these after TestAllTypes to make sure the compiler can handle
///   that.
struct Proto3ForeignMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3ForeignMessage"}
  public var protoMessageName: String {return "ForeignMessage"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "c", swift: "c"),
  ]


  var c: Int32 = 0

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &c)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if c != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: c, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3ForeignMessage) -> Bool {
    if c != other.c {return false}
    return true
  }
}

struct Proto3TestReservedFields: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestReservedFields"}
  public var protoMessageName: String {return "TestReservedFields"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames = FieldNameMap()


  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestReservedFields) -> Bool {
    return true
  }
}

///   Test that we can use NestedMessage from outside TestAllTypes.
struct Proto3TestForeignNested: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestForeignNested"}
  public var protoMessageName: String {return "TestForeignNested"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .unique(proto: "foreign_nested", json: "foreignNested", swift: "foreignNested"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestForeignNested
    var _foreignNested: Proto3TestAllTypes.NestedMessage? = nil

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularMessageField(fieldType: Proto3TestAllTypes.NestedMessage.self, value: &_foreignNested)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if let v = _foreignNested {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 1)
      }
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _foreignNested != other._foreignNested {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._foreignNested = _foreignNested
      return clone
    }
  }

  private var _storage = _StorageClass()


  var foreignNested: Proto3TestAllTypes.NestedMessage {
    get {return _storage._foreignNested ?? Proto3TestAllTypes.NestedMessage()}
    set {_uniqueStorage()._foreignNested = newValue}
  }
  public var hasForeignNested: Bool {
    return _storage._foreignNested != nil
  }
  public mutating func clearForeignNested() {
    return _storage._foreignNested = nil
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestForeignNested) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

///   Test that really large tag numbers don't break anything.
struct Proto3TestReallyLargeTagNumber: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestReallyLargeTagNumber"}
  public var protoMessageName: String {return "TestReallyLargeTagNumber"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "a", swift: "a"),
    268435455: .same(proto: "bb", swift: "bb"),
  ]


  ///   The largest possible tag number is 2^28 - 1, since the wire format uses
  ///   three bits to communicate wire type.
  var a: Int32 = 0

  var bb: Int32 = 0

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &a)
    case 268435455: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &bb)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if a != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: a, protoFieldNumber: 1)
    }
    if bb != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: bb, protoFieldNumber: 268435455)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestReallyLargeTagNumber) -> Bool {
    if a != other.a {return false}
    if bb != other.bb {return false}
    return true
  }
}

struct Proto3TestRecursiveMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestRecursiveMessage"}
  public var protoMessageName: String {return "TestRecursiveMessage"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "a", swift: "a"),
    2: .same(proto: "i", swift: "i"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestRecursiveMessage
    var _a: Proto3TestRecursiveMessage? = nil
    var _i: Int32 = 0

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularMessageField(fieldType: Proto3TestRecursiveMessage.self, value: &_a)
      case 2: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &_i)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if let v = _a {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 1)
      }
      if _i != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: _i, protoFieldNumber: 2)
      }
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _a != other._a {return false}
      if _i != other._i {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._a = _a
      clone._i = _i
      return clone
    }
  }

  private var _storage = _StorageClass()


  var a: Proto3TestRecursiveMessage {
    get {return _storage._a ?? Proto3TestRecursiveMessage()}
    set {_uniqueStorage()._a = newValue}
  }
  public var hasA: Bool {
    return _storage._a != nil
  }
  public mutating func clearA() {
    return _storage._a = nil
  }

  var i: Int32 {
    get {return _storage._i}
    set {_uniqueStorage()._i = newValue}
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestRecursiveMessage) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

///   Test that mutual recursion works.
struct Proto3TestMutualRecursionA: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestMutualRecursionA"}
  public var protoMessageName: String {return "TestMutualRecursionA"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "bb", swift: "bb"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestMutualRecursionA
    var _bb: Proto3TestMutualRecursionB? = nil

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularMessageField(fieldType: Proto3TestMutualRecursionB.self, value: &_bb)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if let v = _bb {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 1)
      }
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _bb != other._bb {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._bb = _bb
      return clone
    }
  }

  private var _storage = _StorageClass()


  var bb: Proto3TestMutualRecursionB {
    get {return _storage._bb ?? Proto3TestMutualRecursionB()}
    set {_uniqueStorage()._bb = newValue}
  }
  public var hasBb: Bool {
    return _storage._bb != nil
  }
  public mutating func clearBb() {
    return _storage._bb = nil
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestMutualRecursionA) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

struct Proto3TestMutualRecursionB: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestMutualRecursionB"}
  public var protoMessageName: String {return "TestMutualRecursionB"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "a", swift: "a"),
    2: .unique(proto: "optional_int32", json: "optionalInt32", swift: "optionalInt32"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestMutualRecursionB
    var _a: Proto3TestMutualRecursionA? = nil
    var _optionalInt32: Int32 = 0

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularMessageField(fieldType: Proto3TestMutualRecursionA.self, value: &_a)
      case 2: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &_optionalInt32)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if let v = _a {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 1)
      }
      if _optionalInt32 != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: _optionalInt32, protoFieldNumber: 2)
      }
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _a != other._a {return false}
      if _optionalInt32 != other._optionalInt32 {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._a = _a
      clone._optionalInt32 = _optionalInt32
      return clone
    }
  }

  private var _storage = _StorageClass()


  var a: Proto3TestMutualRecursionA {
    get {return _storage._a ?? Proto3TestMutualRecursionA()}
    set {_uniqueStorage()._a = newValue}
  }
  public var hasA: Bool {
    return _storage._a != nil
  }
  public mutating func clearA() {
    return _storage._a = nil
  }

  var optionalInt32: Int32 {
    get {return _storage._optionalInt32}
    set {_uniqueStorage()._optionalInt32 = newValue}
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestMutualRecursionB) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

///   Test message with CamelCase field names.  This violates Protocol Buffer
///   standard style.
struct Proto3TestCamelCaseFieldNames: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestCamelCaseFieldNames"}
  public var protoMessageName: String {return "TestCamelCaseFieldNames"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "PrimitiveField", swift: "primitiveField"),
    2: .same(proto: "StringField", swift: "stringField"),
    3: .same(proto: "EnumField", swift: "enumField"),
    4: .same(proto: "MessageField", swift: "messageField"),
    7: .same(proto: "RepeatedPrimitiveField", swift: "repeatedPrimitiveField"),
    8: .same(proto: "RepeatedStringField", swift: "repeatedStringField"),
    9: .same(proto: "RepeatedEnumField", swift: "repeatedEnumField"),
    10: .same(proto: "RepeatedMessageField", swift: "repeatedMessageField"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestCamelCaseFieldNames
    var _primitiveField: Int32 = 0
    var _stringField: String = ""
    var _enumField: Proto3ForeignEnum = Proto3ForeignEnum.foreignUnspecified
    var _messageField: Proto3ForeignMessage? = nil
    var _repeatedPrimitiveField: [Int32] = []
    var _repeatedStringField: [String] = []
    var _repeatedEnumField: [Proto3ForeignEnum] = []
    var _repeatedMessageField: [Proto3ForeignMessage] = []

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &_primitiveField)
      case 2: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: &_stringField)
      case 3: try setter.decodeSingularField(fieldType: Proto3ForeignEnum.self, value: &_enumField)
      case 4: try setter.decodeSingularMessageField(fieldType: Proto3ForeignMessage.self, value: &_messageField)
      case 7: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &_repeatedPrimitiveField)
      case 8: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufString.self, value: &_repeatedStringField)
      case 9: try setter.decodePackedField(fieldType: Proto3ForeignEnum.self, value: &_repeatedEnumField)
      case 10: try setter.decodeRepeatedMessageField(fieldType: Proto3ForeignMessage.self, value: &_repeatedMessageField)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if _primitiveField != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: _primitiveField, protoFieldNumber: 1)
      }
      if _stringField != "" {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: _stringField, protoFieldNumber: 2)
      }
      if _enumField != Proto3ForeignEnum.foreignUnspecified {
        try visitor.visitSingularField(fieldType: Proto3ForeignEnum.self, value: _enumField, protoFieldNumber: 3)
      }
      if let v = _messageField {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 4)
      }
      if !_repeatedPrimitiveField.isEmpty {
        try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: _repeatedPrimitiveField, protoFieldNumber: 7)
      }
      if !_repeatedStringField.isEmpty {
        try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufString.self, value: _repeatedStringField, protoFieldNumber: 8)
      }
      if !_repeatedEnumField.isEmpty {
        try visitor.visitPackedField(fieldType: Proto3ForeignEnum.self, value: _repeatedEnumField, protoFieldNumber: 9)
      }
      if !_repeatedMessageField.isEmpty {
        try visitor.visitRepeatedMessageField(value: _repeatedMessageField, protoFieldNumber: 10)
      }
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _primitiveField != other._primitiveField {return false}
      if _stringField != other._stringField {return false}
      if _enumField != other._enumField {return false}
      if _messageField != other._messageField {return false}
      if _repeatedPrimitiveField != other._repeatedPrimitiveField {return false}
      if _repeatedStringField != other._repeatedStringField {return false}
      if _repeatedEnumField != other._repeatedEnumField {return false}
      if _repeatedMessageField != other._repeatedMessageField {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._primitiveField = _primitiveField
      clone._stringField = _stringField
      clone._enumField = _enumField
      clone._messageField = _messageField
      clone._repeatedPrimitiveField = _repeatedPrimitiveField
      clone._repeatedStringField = _repeatedStringField
      clone._repeatedEnumField = _repeatedEnumField
      clone._repeatedMessageField = _repeatedMessageField
      return clone
    }
  }

  private var _storage = _StorageClass()


  var primitiveField: Int32 {
    get {return _storage._primitiveField}
    set {_uniqueStorage()._primitiveField = newValue}
  }

  var stringField: String {
    get {return _storage._stringField}
    set {_uniqueStorage()._stringField = newValue}
  }

  var enumField: Proto3ForeignEnum {
    get {return _storage._enumField}
    set {_uniqueStorage()._enumField = newValue}
  }

  var messageField: Proto3ForeignMessage {
    get {return _storage._messageField ?? Proto3ForeignMessage()}
    set {_uniqueStorage()._messageField = newValue}
  }
  public var hasMessageField: Bool {
    return _storage._messageField != nil
  }
  public mutating func clearMessageField() {
    return _storage._messageField = nil
  }

  var repeatedPrimitiveField: [Int32] {
    get {return _storage._repeatedPrimitiveField}
    set {_uniqueStorage()._repeatedPrimitiveField = newValue}
  }

  var repeatedStringField: [String] {
    get {return _storage._repeatedStringField}
    set {_uniqueStorage()._repeatedStringField = newValue}
  }

  var repeatedEnumField: [Proto3ForeignEnum] {
    get {return _storage._repeatedEnumField}
    set {_uniqueStorage()._repeatedEnumField = newValue}
  }

  var repeatedMessageField: [Proto3ForeignMessage] {
    get {return _storage._repeatedMessageField}
    set {_uniqueStorage()._repeatedMessageField = newValue}
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestCamelCaseFieldNames) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

///   We list fields out of order, to ensure that we're using field number and not
///   field index to determine serialization order.
struct Proto3TestFieldOrderings: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestFieldOrderings"}
  public var protoMessageName: String {return "TestFieldOrderings"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    11: .unique(proto: "my_string", json: "myString", swift: "myString"),
    1: .unique(proto: "my_int", json: "myInt", swift: "myInt"),
    101: .unique(proto: "my_float", json: "myFloat", swift: "myFloat"),
    200: .unique(proto: "single_nested_message", json: "singleNestedMessage", swift: "singleNestedMessage"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestFieldOrderings
    var _myString: String = ""
    var _myInt: Int64 = 0
    var _myFloat: Float = 0
    var _singleNestedMessage: Proto3TestFieldOrderings.NestedMessage? = nil

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 11: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: &_myString)
      case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &_myInt)
      case 101: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: &_myFloat)
      case 200: try setter.decodeSingularMessageField(fieldType: Proto3TestFieldOrderings.NestedMessage.self, value: &_singleNestedMessage)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if _myInt != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: _myInt, protoFieldNumber: 1)
      }
      if _myString != "" {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: _myString, protoFieldNumber: 11)
      }
      if _myFloat != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: _myFloat, protoFieldNumber: 101)
      }
      if let v = _singleNestedMessage {
        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 200)
      }
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _myString != other._myString {return false}
      if _myInt != other._myInt {return false}
      if _myFloat != other._myFloat {return false}
      if _singleNestedMessage != other._singleNestedMessage {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._myString = _myString
      clone._myInt = _myInt
      clone._myFloat = _myFloat
      clone._singleNestedMessage = _singleNestedMessage
      return clone
    }
  }

  private var _storage = _StorageClass()


  struct NestedMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
    public var swiftClassName: String {return "Proto3TestFieldOrderings.NestedMessage"}
    public var protoMessageName: String {return "NestedMessage"}
    public var protoPackageName: String {return "protobuf_unittest"}
    public static let _protobuf_fieldNames: FieldNameMap = [
      2: .same(proto: "oo", swift: "oo"),
      1: .same(proto: "bb", swift: "bb"),
    ]


    var oo: Int64 = 0

    ///   The field name "b" fails to compile in proto1 because it conflicts with
    ///   a local variable named "b" in one of the generated methods.  Doh.
    ///   This file needs to compile in proto1 to test backwards-compatibility.
    var bb: Int32 = 0

    init() {}

    public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 2: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &oo)
      case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &bb)
      default: break
      }
    }

    public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      if bb != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: bb, protoFieldNumber: 1)
      }
      if oo != 0 {
        try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: oo, protoFieldNumber: 2)
      }
    }

    public func _protoc_generated_isEqualTo(other: Proto3TestFieldOrderings.NestedMessage) -> Bool {
      if oo != other.oo {return false}
      if bb != other.bb {return false}
      return true
    }
  }

  var myString: String {
    get {return _storage._myString}
    set {_uniqueStorage()._myString = newValue}
  }

  var myInt: Int64 {
    get {return _storage._myInt}
    set {_uniqueStorage()._myInt = newValue}
  }

  var myFloat: Float {
    get {return _storage._myFloat}
    set {_uniqueStorage()._myFloat = newValue}
  }

  var singleNestedMessage: Proto3TestFieldOrderings.NestedMessage {
    get {return _storage._singleNestedMessage ?? Proto3TestFieldOrderings.NestedMessage()}
    set {_uniqueStorage()._singleNestedMessage = newValue}
  }
  public var hasSingleNestedMessage: Bool {
    return _storage._singleNestedMessage != nil
  }
  public mutating func clearSingleNestedMessage() {
    return _storage._singleNestedMessage = nil
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestFieldOrderings) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

struct Proto3SparseEnumMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3SparseEnumMessage"}
  public var protoMessageName: String {return "SparseEnumMessage"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .unique(proto: "sparse_enum", json: "sparseEnum", swift: "sparseEnum"),
  ]


  var sparseEnum: Proto3TestSparseEnum = Proto3TestSparseEnum.testSparseEnumUnspecified

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: Proto3TestSparseEnum.self, value: &sparseEnum)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if sparseEnum != Proto3TestSparseEnum.testSparseEnumUnspecified {
      try visitor.visitSingularField(fieldType: Proto3TestSparseEnum.self, value: sparseEnum, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3SparseEnumMessage) -> Bool {
    if sparseEnum != other.sparseEnum {return false}
    return true
  }
}

///   Test String and Bytes: string is for valid UTF-8 strings
struct Proto3OneString: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3OneString"}
  public var protoMessageName: String {return "OneString"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: String = ""

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != "" {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3OneString) -> Bool {
    if data != other.data {return false}
    return true
  }
}

struct Proto3MoreString: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3MoreString"}
  public var protoMessageName: String {return "MoreString"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: [String] = []

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufString.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if !data.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufString.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3MoreString) -> Bool {
    if data != other.data {return false}
    return true
  }
}

struct Proto3OneBytes: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3OneBytes"}
  public var protoMessageName: String {return "OneBytes"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: Data = Data()

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != Data() {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3OneBytes) -> Bool {
    if data != other.data {return false}
    return true
  }
}

struct Proto3MoreBytes: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3MoreBytes"}
  public var protoMessageName: String {return "MoreBytes"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: Data = Data()

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != Data() {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufBytes.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3MoreBytes) -> Bool {
    if data != other.data {return false}
    return true
  }
}

///   Test int32, uint32, int64, uint64, and bool are all compatible
struct Proto3Int32Message: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3Int32Message"}
  public var protoMessageName: String {return "Int32Message"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: Int32 = 0

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3Int32Message) -> Bool {
    if data != other.data {return false}
    return true
  }
}

struct Proto3Uint32Message: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3Uint32Message"}
  public var protoMessageName: String {return "Uint32Message"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: UInt32 = 0

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3Uint32Message) -> Bool {
    if data != other.data {return false}
    return true
  }
}

struct Proto3Int64Message: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3Int64Message"}
  public var protoMessageName: String {return "Int64Message"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: Int64 = 0

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3Int64Message) -> Bool {
    if data != other.data {return false}
    return true
  }
}

struct Proto3Uint64Message: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3Uint64Message"}
  public var protoMessageName: String {return "Uint64Message"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: UInt64 = 0

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != 0 {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3Uint64Message) -> Bool {
    if data != other.data {return false}
    return true
  }
}

struct Proto3BoolMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3BoolMessage"}
  public var protoMessageName: String {return "BoolMessage"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "data", swift: "data"),
  ]


  var data: Bool = false

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufBool.self, value: &data)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if data != false {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufBool.self, value: data, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3BoolMessage) -> Bool {
    if data != other.data {return false}
    return true
  }
}

///   Test oneofs.
struct Proto3TestOneof: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestOneof"}
  public var protoMessageName: String {return "TestOneof"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .unique(proto: "foo_int", json: "fooInt", swift: "fooInt"),
    2: .unique(proto: "foo_string", json: "fooString", swift: "fooString"),
    3: .unique(proto: "foo_message", json: "fooMessage", swift: "fooMessage"),
  ]

  private class _StorageClass {
    typealias ExtendedMessage = Proto3TestOneof
    var _foo = Proto3TestOneof.OneOf_Foo()

    init() {}

    func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      switch protoFieldNumber {
      case 1, 2, 3: try _foo.decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
      default: break
      }
    }

    func traverse(visitor: inout SwiftProtobuf.Visitor) throws {
      try _foo.traverse(visitor: &visitor, start: 1, end: 4)
    }

    func isEqualTo(other: _StorageClass) -> Bool {
      if _foo != other._foo {return false}
      return true
    }

    func copy() -> _StorageClass {
      let clone = _StorageClass()
      clone._foo = _foo
      return clone
    }
  }

  private var _storage = _StorageClass()


  enum OneOf_Foo: ExpressibleByNilLiteral, SwiftProtobuf.OneofEnum {
    case fooInt(Int32)
    case fooString(String)
    case fooMessage(Proto3TestAllTypes)
    case None

    public init(nilLiteral: ()) {
      self = .None
    }

    public init() {
      self = .None
    }

    public mutating func decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
      if self != .None && setter.rejectConflictingOneof {
        throw SwiftProtobuf.DecodingError.duplicatedOneOf
      }
      switch protoFieldNumber {
      case 1:
        var value = Int32()
        try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &value)
        self = .fooInt(value)
      case 2:
        var value = String()
        try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: &value)
        self = .fooString(value)
      case 3:
        var value: Proto3TestAllTypes?
        try setter.decodeSingularMessageField(fieldType: Proto3TestAllTypes.self, value: &value)
        if let value = value {
          self = .fooMessage(value)
        }
      default:
        self = .None
      }
    }

    public func traverse(visitor: inout SwiftProtobuf.Visitor, start: Int, end: Int) throws {
      switch self {
      case .fooInt(let v):
        if start <= 1 && 1 < end {
          try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: v, protoFieldNumber: 1)
        }
      case .fooString(let v):
        if start <= 2 && 2 < end {
          try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: v, protoFieldNumber: 2)
        }
      case .fooMessage(let v):
        if start <= 3 && 3 < end {
          try visitor.visitSingularMessageField(value: v, protoFieldNumber: 3)
        }
      case .None:
        break
      }
    }
  }

  var fooInt: Int32 {
    get {
      if case .fooInt(let v) = _storage._foo {
        return v
      }
      return 0
    }
    set {
      _uniqueStorage()._foo = .fooInt(newValue)
    }
  }

  var fooString: String {
    get {
      if case .fooString(let v) = _storage._foo {
        return v
      }
      return ""
    }
    set {
      _uniqueStorage()._foo = .fooString(newValue)
    }
  }

  var fooMessage: Proto3TestAllTypes {
    get {
      if case .fooMessage(let v) = _storage._foo {
        return v
      }
      return Proto3TestAllTypes()
    }
    set {
      _uniqueStorage()._foo = .fooMessage(newValue)
    }
  }

  public var foo: OneOf_Foo {
    get {return _storage._foo}
    set {
      _uniqueStorage()._foo = newValue
    }
  }

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    try _storage.traverse(visitor: &visitor)
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestOneof) -> Bool {
    return _storage === other._storage || _storage.isEqualTo(other: other._storage)
  }

  private mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _storage.copy()
    }
    return _storage
  }
}

//  Test messages for packed fields

struct Proto3TestPackedTypes: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestPackedTypes"}
  public var protoMessageName: String {return "TestPackedTypes"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    90: .unique(proto: "packed_int32", json: "packedInt32", swift: "packedInt32"),
    91: .unique(proto: "packed_int64", json: "packedInt64", swift: "packedInt64"),
    92: .unique(proto: "packed_uint32", json: "packedUint32", swift: "packedUint32"),
    93: .unique(proto: "packed_uint64", json: "packedUint64", swift: "packedUint64"),
    94: .unique(proto: "packed_sint32", json: "packedSint32", swift: "packedSint32"),
    95: .unique(proto: "packed_sint64", json: "packedSint64", swift: "packedSint64"),
    96: .unique(proto: "packed_fixed32", json: "packedFixed32", swift: "packedFixed32"),
    97: .unique(proto: "packed_fixed64", json: "packedFixed64", swift: "packedFixed64"),
    98: .unique(proto: "packed_sfixed32", json: "packedSfixed32", swift: "packedSfixed32"),
    99: .unique(proto: "packed_sfixed64", json: "packedSfixed64", swift: "packedSfixed64"),
    100: .unique(proto: "packed_float", json: "packedFloat", swift: "packedFloat"),
    101: .unique(proto: "packed_double", json: "packedDouble", swift: "packedDouble"),
    102: .unique(proto: "packed_bool", json: "packedBool", swift: "packedBool"),
    103: .unique(proto: "packed_enum", json: "packedEnum", swift: "packedEnum"),
  ]


  var packedInt32: [Int32] = []

  var packedInt64: [Int64] = []

  var packedUint32: [UInt32] = []

  var packedUint64: [UInt64] = []

  var packedSint32: [Int32] = []

  var packedSint64: [Int64] = []

  var packedFixed32: [UInt32] = []

  var packedFixed64: [UInt64] = []

  var packedSfixed32: [Int32] = []

  var packedSfixed64: [Int64] = []

  var packedFloat: [Float] = []

  var packedDouble: [Double] = []

  var packedBool: [Bool] = []

  var packedEnum: [Proto3ForeignEnum] = []

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 90: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &packedInt32)
    case 91: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &packedInt64)
    case 92: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: &packedUint32)
    case 93: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: &packedUint64)
    case 94: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: &packedSint32)
    case 95: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: &packedSint64)
    case 96: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: &packedFixed32)
    case 97: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: &packedFixed64)
    case 98: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: &packedSfixed32)
    case 99: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: &packedSfixed64)
    case 100: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: &packedFloat)
    case 101: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: &packedDouble)
    case 102: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufBool.self, value: &packedBool)
    case 103: try setter.decodePackedField(fieldType: Proto3ForeignEnum.self, value: &packedEnum)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if !packedInt32.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: packedInt32, protoFieldNumber: 90)
    }
    if !packedInt64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: packedInt64, protoFieldNumber: 91)
    }
    if !packedUint32.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: packedUint32, protoFieldNumber: 92)
    }
    if !packedUint64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: packedUint64, protoFieldNumber: 93)
    }
    if !packedSint32.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: packedSint32, protoFieldNumber: 94)
    }
    if !packedSint64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: packedSint64, protoFieldNumber: 95)
    }
    if !packedFixed32.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: packedFixed32, protoFieldNumber: 96)
    }
    if !packedFixed64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: packedFixed64, protoFieldNumber: 97)
    }
    if !packedSfixed32.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: packedSfixed32, protoFieldNumber: 98)
    }
    if !packedSfixed64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: packedSfixed64, protoFieldNumber: 99)
    }
    if !packedFloat.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: packedFloat, protoFieldNumber: 100)
    }
    if !packedDouble.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: packedDouble, protoFieldNumber: 101)
    }
    if !packedBool.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufBool.self, value: packedBool, protoFieldNumber: 102)
    }
    if !packedEnum.isEmpty {
      try visitor.visitPackedField(fieldType: Proto3ForeignEnum.self, value: packedEnum, protoFieldNumber: 103)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestPackedTypes) -> Bool {
    if packedInt32 != other.packedInt32 {return false}
    if packedInt64 != other.packedInt64 {return false}
    if packedUint32 != other.packedUint32 {return false}
    if packedUint64 != other.packedUint64 {return false}
    if packedSint32 != other.packedSint32 {return false}
    if packedSint64 != other.packedSint64 {return false}
    if packedFixed32 != other.packedFixed32 {return false}
    if packedFixed64 != other.packedFixed64 {return false}
    if packedSfixed32 != other.packedSfixed32 {return false}
    if packedSfixed64 != other.packedSfixed64 {return false}
    if packedFloat != other.packedFloat {return false}
    if packedDouble != other.packedDouble {return false}
    if packedBool != other.packedBool {return false}
    if packedEnum != other.packedEnum {return false}
    return true
  }
}

///   A message with the same fields as TestPackedTypes, but without packing. Used
///   to test packed <-> unpacked wire compatibility.
struct Proto3TestUnpackedTypes: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestUnpackedTypes"}
  public var protoMessageName: String {return "TestUnpackedTypes"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    90: .unique(proto: "unpacked_int32", json: "unpackedInt32", swift: "unpackedInt32"),
    91: .unique(proto: "unpacked_int64", json: "unpackedInt64", swift: "unpackedInt64"),
    92: .unique(proto: "unpacked_uint32", json: "unpackedUint32", swift: "unpackedUint32"),
    93: .unique(proto: "unpacked_uint64", json: "unpackedUint64", swift: "unpackedUint64"),
    94: .unique(proto: "unpacked_sint32", json: "unpackedSint32", swift: "unpackedSint32"),
    95: .unique(proto: "unpacked_sint64", json: "unpackedSint64", swift: "unpackedSint64"),
    96: .unique(proto: "unpacked_fixed32", json: "unpackedFixed32", swift: "unpackedFixed32"),
    97: .unique(proto: "unpacked_fixed64", json: "unpackedFixed64", swift: "unpackedFixed64"),
    98: .unique(proto: "unpacked_sfixed32", json: "unpackedSfixed32", swift: "unpackedSfixed32"),
    99: .unique(proto: "unpacked_sfixed64", json: "unpackedSfixed64", swift: "unpackedSfixed64"),
    100: .unique(proto: "unpacked_float", json: "unpackedFloat", swift: "unpackedFloat"),
    101: .unique(proto: "unpacked_double", json: "unpackedDouble", swift: "unpackedDouble"),
    102: .unique(proto: "unpacked_bool", json: "unpackedBool", swift: "unpackedBool"),
    103: .unique(proto: "unpacked_enum", json: "unpackedEnum", swift: "unpackedEnum"),
  ]


  var unpackedInt32: [Int32] = []

  var unpackedInt64: [Int64] = []

  var unpackedUint32: [UInt32] = []

  var unpackedUint64: [UInt64] = []

  var unpackedSint32: [Int32] = []

  var unpackedSint64: [Int64] = []

  var unpackedFixed32: [UInt32] = []

  var unpackedFixed64: [UInt64] = []

  var unpackedSfixed32: [Int32] = []

  var unpackedSfixed64: [Int64] = []

  var unpackedFloat: [Float] = []

  var unpackedDouble: [Double] = []

  var unpackedBool: [Bool] = []

  var unpackedEnum: [Proto3ForeignEnum] = []

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 90: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &unpackedInt32)
    case 91: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &unpackedInt64)
    case 92: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: &unpackedUint32)
    case 93: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: &unpackedUint64)
    case 94: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: &unpackedSint32)
    case 95: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: &unpackedSint64)
    case 96: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: &unpackedFixed32)
    case 97: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: &unpackedFixed64)
    case 98: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: &unpackedSfixed32)
    case 99: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: &unpackedSfixed64)
    case 100: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: &unpackedFloat)
    case 101: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: &unpackedDouble)
    case 102: try setter.decodeRepeatedField(fieldType: SwiftProtobuf.ProtobufBool.self, value: &unpackedBool)
    case 103: try setter.decodeRepeatedField(fieldType: Proto3ForeignEnum.self, value: &unpackedEnum)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if !unpackedInt32.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: unpackedInt32, protoFieldNumber: 90)
    }
    if !unpackedInt64.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: unpackedInt64, protoFieldNumber: 91)
    }
    if !unpackedUint32.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufUInt32.self, value: unpackedUint32, protoFieldNumber: 92)
    }
    if !unpackedUint64.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: unpackedUint64, protoFieldNumber: 93)
    }
    if !unpackedSint32.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufSInt32.self, value: unpackedSint32, protoFieldNumber: 94)
    }
    if !unpackedSint64.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufSInt64.self, value: unpackedSint64, protoFieldNumber: 95)
    }
    if !unpackedFixed32.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: unpackedFixed32, protoFieldNumber: 96)
    }
    if !unpackedFixed64.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: unpackedFixed64, protoFieldNumber: 97)
    }
    if !unpackedSfixed32.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufSFixed32.self, value: unpackedSfixed32, protoFieldNumber: 98)
    }
    if !unpackedSfixed64.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufSFixed64.self, value: unpackedSfixed64, protoFieldNumber: 99)
    }
    if !unpackedFloat.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: unpackedFloat, protoFieldNumber: 100)
    }
    if !unpackedDouble.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufDouble.self, value: unpackedDouble, protoFieldNumber: 101)
    }
    if !unpackedBool.isEmpty {
      try visitor.visitRepeatedField(fieldType: SwiftProtobuf.ProtobufBool.self, value: unpackedBool, protoFieldNumber: 102)
    }
    if !unpackedEnum.isEmpty {
      try visitor.visitRepeatedField(fieldType: Proto3ForeignEnum.self, value: unpackedEnum, protoFieldNumber: 103)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestUnpackedTypes) -> Bool {
    if unpackedInt32 != other.unpackedInt32 {return false}
    if unpackedInt64 != other.unpackedInt64 {return false}
    if unpackedUint32 != other.unpackedUint32 {return false}
    if unpackedUint64 != other.unpackedUint64 {return false}
    if unpackedSint32 != other.unpackedSint32 {return false}
    if unpackedSint64 != other.unpackedSint64 {return false}
    if unpackedFixed32 != other.unpackedFixed32 {return false}
    if unpackedFixed64 != other.unpackedFixed64 {return false}
    if unpackedSfixed32 != other.unpackedSfixed32 {return false}
    if unpackedSfixed64 != other.unpackedSfixed64 {return false}
    if unpackedFloat != other.unpackedFloat {return false}
    if unpackedDouble != other.unpackedDouble {return false}
    if unpackedBool != other.unpackedBool {return false}
    if unpackedEnum != other.unpackedEnum {return false}
    return true
  }
}

struct Proto3TestRepeatedScalarDifferentTagSizes: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestRepeatedScalarDifferentTagSizes"}
  public var protoMessageName: String {return "TestRepeatedScalarDifferentTagSizes"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    12: .unique(proto: "repeated_fixed32", json: "repeatedFixed32", swift: "repeatedFixed32"),
    13: .unique(proto: "repeated_int32", json: "repeatedInt32", swift: "repeatedInt32"),
    2046: .unique(proto: "repeated_fixed64", json: "repeatedFixed64", swift: "repeatedFixed64"),
    2047: .unique(proto: "repeated_int64", json: "repeatedInt64", swift: "repeatedInt64"),
    262142: .unique(proto: "repeated_float", json: "repeatedFloat", swift: "repeatedFloat"),
    262143: .unique(proto: "repeated_uint64", json: "repeatedUint64", swift: "repeatedUint64"),
  ]


  ///   Parsing repeated fixed size values used to fail. This message needs to be
  ///   used in order to get a tag of the right size; all of the repeated fields
  ///   in TestAllTypes didn't trigger the check.
  var repeatedFixed32: [UInt32] = []

  ///   Check for a varint type, just for good measure.
  var repeatedInt32: [Int32] = []

  ///   These have two-byte tags.
  var repeatedFixed64: [UInt64] = []

  var repeatedInt64: [Int64] = []

  ///   Three byte tags.
  var repeatedFloat: [Float] = []

  var repeatedUint64: [UInt64] = []

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 12: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: &repeatedFixed32)
    case 13: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: &repeatedInt32)
    case 2046: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: &repeatedFixed64)
    case 2047: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: &repeatedInt64)
    case 262142: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: &repeatedFloat)
    case 262143: try setter.decodePackedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: &repeatedUint64)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if !repeatedFixed32.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFixed32.self, value: repeatedFixed32, protoFieldNumber: 12)
    }
    if !repeatedInt32.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufInt32.self, value: repeatedInt32, protoFieldNumber: 13)
    }
    if !repeatedFixed64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFixed64.self, value: repeatedFixed64, protoFieldNumber: 2046)
    }
    if !repeatedInt64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufInt64.self, value: repeatedInt64, protoFieldNumber: 2047)
    }
    if !repeatedFloat.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufFloat.self, value: repeatedFloat, protoFieldNumber: 262142)
    }
    if !repeatedUint64.isEmpty {
      try visitor.visitPackedField(fieldType: SwiftProtobuf.ProtobufUInt64.self, value: repeatedUint64, protoFieldNumber: 262143)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestRepeatedScalarDifferentTagSizes) -> Bool {
    if repeatedFixed32 != other.repeatedFixed32 {return false}
    if repeatedInt32 != other.repeatedInt32 {return false}
    if repeatedFixed64 != other.repeatedFixed64 {return false}
    if repeatedInt64 != other.repeatedInt64 {return false}
    if repeatedFloat != other.repeatedFloat {return false}
    if repeatedUint64 != other.repeatedUint64 {return false}
    return true
  }
}

struct Proto3TestCommentInjectionMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3TestCommentInjectionMessage"}
  public var protoMessageName: String {return "TestCommentInjectionMessage"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames: FieldNameMap = [
    1: .same(proto: "a", swift: "a"),
  ]


  ///   */ <- This should not close the generated doc comment
  var a: String = ""

  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
    switch protoFieldNumber {
    case 1: try setter.decodeSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: &a)
    default: break
    }
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
    if a != "" {
      try visitor.visitSingularField(fieldType: SwiftProtobuf.ProtobufString.self, value: a, protoFieldNumber: 1)
    }
  }

  public func _protoc_generated_isEqualTo(other: Proto3TestCommentInjectionMessage) -> Bool {
    if a != other.a {return false}
    return true
  }
}

///   Test that RPC services work.
struct Proto3FooRequest: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3FooRequest"}
  public var protoMessageName: String {return "FooRequest"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames = FieldNameMap()


  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
  }

  public func _protoc_generated_isEqualTo(other: Proto3FooRequest) -> Bool {
    return true
  }
}

struct Proto3FooResponse: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3FooResponse"}
  public var protoMessageName: String {return "FooResponse"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames = FieldNameMap()


  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
  }

  public func _protoc_generated_isEqualTo(other: Proto3FooResponse) -> Bool {
    return true
  }
}

struct Proto3FooClientMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3FooClientMessage"}
  public var protoMessageName: String {return "FooClientMessage"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames = FieldNameMap()


  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
  }

  public func _protoc_generated_isEqualTo(other: Proto3FooClientMessage) -> Bool {
    return true
  }
}

struct Proto3FooServerMessage: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3FooServerMessage"}
  public var protoMessageName: String {return "FooServerMessage"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames = FieldNameMap()


  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
  }

  public func _protoc_generated_isEqualTo(other: Proto3FooServerMessage) -> Bool {
    return true
  }
}

struct Proto3BarRequest: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3BarRequest"}
  public var protoMessageName: String {return "BarRequest"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames = FieldNameMap()


  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
  }

  public func _protoc_generated_isEqualTo(other: Proto3BarRequest) -> Bool {
    return true
  }
}

struct Proto3BarResponse: SwiftProtobuf.Message, SwiftProtobuf.Proto3Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf.ProtoNameProviding {
  public var swiftClassName: String {return "Proto3BarResponse"}
  public var protoMessageName: String {return "BarResponse"}
  public var protoPackageName: String {return "protobuf_unittest"}
  public static let _protobuf_fieldNames = FieldNameMap()


  init() {}

  public mutating func _protoc_generated_decodeField(setter: inout SwiftProtobuf.FieldDecoder, protoFieldNumber: Int) throws {
  }

  public func _protoc_generated_traverse(visitor: inout SwiftProtobuf.Visitor) throws {
  }

  public func _protoc_generated_isEqualTo(other: Proto3BarResponse) -> Bool {
    return true
  }
}

func ==(lhs: Proto3TestAllTypes.OneOf_OneofField, rhs: Proto3TestAllTypes.OneOf_OneofField) -> Bool {
  switch (lhs, rhs) {
  case (.oneofUint32(let l), .oneofUint32(let r)): return l == r
  case (.oneofNestedMessage(let l), .oneofNestedMessage(let r)): return l == r
  case (.oneofString(let l), .oneofString(let r)): return l == r
  case (.oneofBytes(let l), .oneofBytes(let r)): return l == r
  case (.None, .None): return true
  default: return false
  }
}

func ==(lhs: Proto3TestOneof.OneOf_Foo, rhs: Proto3TestOneof.OneOf_Foo) -> Bool {
  switch (lhs, rhs) {
  case (.fooInt(let l), .fooInt(let r)): return l == r
  case (.fooString(let l), .fooString(let r)): return l == r
  case (.fooMessage(let l), .fooMessage(let r)): return l == r
  case (.None, .None): return true
  default: return false
  }
}
