chromium/third_party/protobuf/objectivec/Tests/unittest_objc.proto

// Protocol Buffers - Google's data interchange format
// Copyright 2011 Google Inc.  All rights reserved.
//
// 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.

syntax = "proto2";

import "google/protobuf/any.proto";
import "google/protobuf/unittest.proto";

package protobuf_unittest;

// Used to check that Headerdocs and appledoc work correctly. If these comments
// are not handled correctly, Xcode will fail to build the tests.
message TestGeneratedComments {
  // This is a string that could contain stuff like
  // mime types as image/* or */plain. Maybe twitter usernames
  // like @protobuf, @google or @something.
  optional string string_field = 1;
}

// Using the messages in unittest.proto, setup for recursive cases for testing
// extensions at various depths.
extend TestAllExtensions {
  optional TestAllExtensions recursive_extension = 86;
}

// Recursive message to for testing autocreators at different depths.
message TestRecursiveMessageWithRepeatedField {
  optional TestRecursiveMessageWithRepeatedField a = 1;
  repeated int32 i = 2;
  repeated string str = 3;
  map<int32, int32> i_to_i = 4;
  map<string, string> str_to_str = 5;
}

// Message with a few types of maps to cover the different custom flows
// in the runtime.
message TestMessageOfMaps {
  map<string, string> str_to_str = 1;

  map<string, int32> str_to_int = 2;
  map<int32, string> int_to_str = 3;
  map<int32, int32> int_to_int = 4;

  map<string, bool> str_to_bool = 5;
  map<bool, string> bool_to_str = 6;
  map<bool, bool> bool_to_bool = 7;

  map<int32, bool> int_to_bool = 8;
  map<bool, int32> bool_to_int = 9;

  map<string, TestAllTypes> str_to_msg = 10;
  map<int32, TestAllTypes> int_to_msg = 11;
  map<bool, TestAllTypes> bool_to_msg = 12;
}

// Recursive message and extension to for testing autocreators at different
// depths.
message TestRecursiveExtension {
  optional TestRecursiveExtension recursive_sub_message = 1;
  repeated int32 repeated_value = 2;
  extensions 1000 to max;
}

extend TestRecursiveExtension {
  optional TestRecursiveExtension recursive_message_extension = 1000;
}

message self {
  message super {
    optional int32 description = 1;
  }

  enum autorelease {
    retain      = 1;
    release     = 2;
    retainCount = 3;
  }

  // Singular
  // Objective C Keywords
  optional bool id                =  1;
  optional bool _cmd              =  2;
  // super is used as submessage above
  optional bool in                =  4;
  optional bool out               =  5;
  optional bool inout             =  6;
  optional bool bycopy            =  7;
  optional bool byref             =  8;
  optional bool oneway            =  9;
  optional bool self              =  10;
  optional bool instancetype      =  11;
  optional bool nullable          =  12;
  optional bool nonnull           =  13;
  optional bool nil               =  14;
  // Nil and nil can't be in the same message
  optional bool YES               =  16;
  optional bool NO                =  17;
  optional bool weak              =  18;

  // Some C/C++ Keywords
  optional bool case              = 30;
  optional bool if                = 31;
  optional bool and_eq            = 32;
  optional bool public            = 33;
  optional bool private           = 34;
  optional bool typename          = 35;
  optional bool static_cast       = 36;
  optional bool typeof            = 37;
  optional bool restrict          = 38;
  optional bool NULL              = 39;

  // Some NSObject Methods
  optional bool dealloc           = 110;
  optional bool isProxy           = 111;
  optional bool copy              = 112;
  optional bool description       = 113;
  optional bool zone              = 114;
  optional bool className         = 115;
  optional bool __retain_OA       = 116;
  optional bool CAMLType          = 117;
  optional bool isNSDictionary__  = 118;
  optional bool accessibilityLabel = 119;

  // Some Objc "keywords" that we shouldn't
  // have to worry about because they
  // can only appear in specialized areas.
  optional bool assign            = 200;
  optional bool getter            = 201;
  optional bool setter            = 202;
  optional bool atomic            = 203;
  optional bool nonatomic         = 204;
  optional bool strong            = 205;
  optional bool null_resettable   = 206;
  optional bool readonly          = 207;

  // Some GPBMessage methods
  optional bool clear             = 300;
  optional bool data              = 301;
  optional bool descriptor        = 302;
  optional bool delimitedData     = 303;

  // Some MacTypes
  optional bool Fixed             = 400;
  optional bool Point             = 401;
  optional bool FixedPoint        = 402;
  optional bool Style             = 403;

  // C/C++ reserved identifiers
  optional bool _Generic          = 500;
  optional bool __block           = 501;

  // Try a keyword as a type
  optional autorelease SubEnum    = 1000;

  optional group New = 2000 {
   optional string copy = 1;
  }
  optional group MutableCopy = 2001 {
    optional int32 extensionRegistry = 1;
  }

  extensions 3000 to 3999;

}

enum retain {
  count          = 4;
  initialized    = 5;
  serializedSize = 6;
}

message ObjCPropertyNaming {
  // Test that the properties properly get things all caps.
  optional string url           = 1;
  optional string thumbnail_url = 2;
  optional string url_foo       = 3;
  optional string some_url_blah = 4;
  optional string http          = 5;
  optional string https         = 6;
  // This one doesn't.
  repeated string urls          = 7;
}

// EnumValueShortName: The short names shouldn't get suffixes/prefixes.
enum Foo {
  SERIALIZED_SIZE = 1;
  SIZE            = 2;
  OTHER           = 3;
}

// EnumValueShortName: The enum name gets a prefix.
enum Category {
  RED  = 1;
  BLUE = 2;
}

// EnumValueShortName: Twist case, full name gets PB, but the short names
// should still end up correct.
enum Time {
  BASE            = 1;
  RECORD          = 2;
  SOMETHING_ELSE  = 3;
}

extend self {
  repeated    int32 debugDescription    =  3000 [packed = true];
  repeated    int64 finalize            =  3001 [packed = true];
  repeated   uint32 hash                =  3002 [packed = true];
  repeated   uint64 classForCoder       =  3003 [packed = true];
  repeated   sint32 byref               =  3004 [packed = true];
}

// Test handing of fields that start with init* since Xcode 5's ARC support
// doesn't like messages that look like initializers but aren't.
message ObjCInitFoo {
  optional string init_val = 11;
  optional int32 init_size = 12;
  optional self init_self = 13;

  repeated string init_vals = 21;
  repeated int32 init_sizes = 22;
  repeated self init_selfs = 23;
}

// Test handling of fields that start with retained names.
message ObjCRetainedFoo {
  optional string new_val_lower_complex = 11;
  optional string new_Val_upper_complex = 12;
  optional string newvalue_lower_no_underscore_complex = 13;
  optional string newValue_upper_no_underscore_complex = 14;

  optional int32 new_val_lower_primitive = 15;
  optional int32 new_Val_upper_primitive = 16;
  optional int32 newvalue_lower_no_underscore_primitive = 17;
  optional int32 newValue_upper_no_underscore_primitive = 18;

  optional self new_val_lower_message = 19;
  optional self new_Val_upper_message = 20;
  optional self newvalue_lower_no_underscore_message = 21;
  optional self newValue_upper_no_underscore_message = 22;

  optional Foo new_val_lower_enum = 23;
  optional Foo new_Val_upper_enum = 24;
  optional Foo newvalue_lower_no_underscore_enum = 25;
  optional Foo newValue_upper_no_underscore_enum = 26;

  repeated string new_val_lower_complex_repeated = 111;
  repeated string new_Val_upper_complex_repeated = 112;
  repeated string newvalue_lower_no_underscore_complex_repeated = 113;
  repeated string newValue_upper_no_underscore_complex_repeated = 114;

  repeated int32 new_val_lower_primitive_repeated = 115;
  repeated int32 new_Val_upper_primitive_repeated = 116;
  repeated int32 newvalue_lower_no_underscore_primitive_repeated = 117;
  repeated int32 newValue_upper_no_underscore_primitive_repeated = 118;

  repeated self new_val_lower_message_repeated = 119;
  repeated self new_Val_upper_message_repeated = 120;
  repeated self newvalue_lower_no_underscore_message_repeated = 121;
  repeated self newValue_upper_no_underscore_message_repeated = 122;

  repeated Foo new_val_lower_enum_repeated = 123;
  repeated Foo new_Val_upper_enum_repeated = 124;
  repeated Foo newvalue_lower_no_underscore_enum_repeated = 125;
  repeated Foo newValue_upper_no_underscore_enum_repeated = 126;

  optional string alloc_val_lower_complex = 211;
  optional string alloc_Val_upper_complex = 212;
  optional string allocvalue_lower_no_underscore_complex = 213;
  optional string allocValue_upper_no_underscore_complex = 214;

  optional int32 alloc_val_lower_primitive = 215;
  optional int32 alloc_Val_upper_primitive = 216;
  optional int32 allocvalue_lower_no_underscore_primitive = 217;
  optional int32 allocValue_upper_no_underscore_primitive = 218;

  optional self alloc_val_lower_message = 219;
  optional self alloc_Val_upper_message = 220;
  optional self allocvalue_lower_no_underscore_message = 221;
  optional self allocValue_upper_no_underscore_message = 222;

  optional Foo alloc_val_lower_enum = 223;
  optional Foo alloc_Val_upper_enum = 224;
  optional Foo allocvalue_lower_no_underscore_enum = 225;
  optional Foo allocValue_upper_no_underscore_enum = 226;

  repeated string alloc_val_lower_complex_repeated = 311;
  repeated string alloc_Val_upper_complex_repeated = 312;
  repeated string allocvalue_lower_no_underscore_complex_repeated = 313;
  repeated string allocValue_upper_no_underscore_complex_repeated = 314;

  repeated int32 alloc_val_lower_primitive_repeated = 315;
  repeated int32 alloc_Val_upper_primitive_repeated = 316;
  repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 317;
  repeated int32 allocValue_upper_no_underscore_primitive_repeated = 318;

  repeated self alloc_val_lower_message_repeated = 319;
  repeated self alloc_Val_upper_message_repeated = 320;
  repeated self allocvalue_lower_no_underscore_message_repeated = 321;
  repeated self allocValue_upper_no_underscore_message_repeated = 322;

  repeated Foo alloc_val_lower_enum_repeated = 323;
  repeated Foo alloc_Val_upper_enum_repeated = 324;
  repeated Foo allocvalue_lower_no_underscore_enum_repeated = 325;
  repeated Foo allocValue_upper_no_underscore_enum_repeated = 326;

  optional string copy_val_lower_complex = 411;
  optional string copy_Val_upper_complex = 412;
  optional string copyvalue_lower_no_underscore_complex = 413;
  optional string copyValue_upper_no_underscore_complex = 414;

  optional int32 copy_val_lower_primitive = 415;
  optional int32 copy_Val_upper_primitive = 416;
  optional int32 copyvalue_lower_no_underscore_primitive = 417;
  optional int32 copyValue_upper_no_underscore_primitive = 418;

  optional self copy_val_lower_message = 419;
  optional self copy_Val_upper_message = 420;
  optional self copyvalue_lower_no_underscore_message = 421;
  optional self copyValue_upper_no_underscore_message = 422;

  optional Foo copy_val_lower_enum = 423;
  optional Foo copy_Val_upper_enum = 424;
  optional Foo copyvalue_lower_no_underscore_enum = 425;
  optional Foo copyValue_upper_no_underscore_enum = 426;

  repeated string copy_val_lower_complex_repeated = 511;
  repeated string copy_Val_upper_complex_repeated = 512;
  repeated string copyvalue_lower_no_underscore_complex_repeated = 513;
  repeated string copyValue_upper_no_underscore_complex_repeated = 514;

  repeated int32 copy_val_lower_primitive_repeated = 515;
  repeated int32 copy_Val_upper_primitive_repeated = 516;
  repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 517;
  repeated int32 copyValue_upper_no_underscore_primitive_repeated = 518;

  repeated self copy_val_lower_message_repeated = 519;
  repeated self copy_Val_upper_message_repeated = 520;
  repeated self copyvalue_lower_no_underscore_message_repeated = 521;
  repeated self copyValue_upper_no_underscore_message_repeated = 522;

  repeated Foo copy_val_lower_enum_repeated = 523;
  repeated Foo copy_Val_upper_enum_repeated = 524;
  repeated Foo copyvalue_lower_no_underscore_enum_repeated = 525;
  repeated Foo copyValue_upper_no_underscore_enum_repeated = 526;

  optional string mutableCopy_val_lower_complex = 611;
  optional string mutableCopy_Val_upper_complex = 612;
  optional string mutableCopyvalue_lower_no_underscore_complex = 613;
  optional string mutableCopyValue_upper_no_underscore_complex = 614;

  optional int32 mutableCopy_val_lower_primitive = 615;
  optional int32 mutableCopy_Val_upper_primitive = 616;
  optional int32 mutableCopyvalue_lower_no_underscore_primitive = 617;
  optional int32 mutableCopyValue_upper_no_underscore_primitive = 618;

  optional self mutableCopy_val_lower_message = 619;
  optional self mutableCopy_Val_upper_message = 620;
  optional self mutableCopyvalue_lower_no_underscore_message = 621;
  optional self mutableCopyValue_upper_no_underscore_message = 622;

  optional Foo mutableCopy_val_lower_enum = 623;
  optional Foo mutableCopy_Val_upper_enum = 624;
  optional Foo mutableCopyvalue_lower_no_underscore_enum = 625;
  optional Foo mutableCopyValue_upper_no_underscore_enum = 626;

  repeated string mutableCopy_val_lower_complex_repeated = 711;
  repeated string mutableCopy_Val_upper_complex_repeated = 712;
  repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 713;
  repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 714;

  repeated int32 mutableCopy_val_lower_primitive_repeated = 715;
  repeated int32 mutableCopy_Val_upper_primitive_repeated = 716;
  repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 717;
  repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 718;

  repeated self mutableCopy_val_lower_message_repeated = 719;
  repeated self mutableCopy_Val_upper_message_repeated = 720;
  repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 721;
  repeated self mutableCopyValue_upper_no_underscore_message_repeated = 722;

  repeated Foo mutableCopy_val_lower_enum_repeated = 723;
  repeated Foo mutableCopy_Val_upper_enum_repeated = 724;
  repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 725;
  repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 726;

  extensions 1000 to 3999;
}

// Extension fields with retained names.
extend ObjCRetainedFoo {
  optional string new_val_lower_complex = 1011;
  optional string new_Val_upper_complex = 1012;
  optional string newvalue_lower_no_underscore_complex = 1013;
  optional string newValue_upper_no_underscore_complex = 1014;

  optional int32 new_val_lower_primitive = 1015;
  optional int32 new_Val_upper_primitive = 1016;
  optional int32 newvalue_lower_no_underscore_primitive = 1017;
  optional int32 newValue_upper_no_underscore_primitive = 1018;

  optional self new_val_lower_message = 1019;
  optional self new_Val_upper_message = 1020;
  optional self newvalue_lower_no_underscore_message = 1021;
  optional self newValue_upper_no_underscore_message = 1022;

  optional Foo new_val_lower_enum = 1023;
  optional Foo new_Val_upper_enum = 1024;
  optional Foo newvalue_lower_no_underscore_enum = 1025;
  optional Foo newValue_upper_no_underscore_enum = 1026;

  repeated string new_val_lower_complex_repeated = 1111;
  repeated string new_Val_upper_complex_repeated = 1112;
  repeated string newvalue_lower_no_underscore_complex_repeated = 1113;
  repeated string newValue_upper_no_underscore_complex_repeated = 1114;

  repeated int32 new_val_lower_primitive_repeated = 1115;
  repeated int32 new_Val_upper_primitive_repeated = 1116;
  repeated int32 newvalue_lower_no_underscore_primitive_repeated = 1117;
  repeated int32 newValue_upper_no_underscore_primitive_repeated = 1118;

  repeated self new_val_lower_message_repeated = 1119;
  repeated self new_Val_upper_message_repeated = 1120;
  repeated self newvalue_lower_no_underscore_message_repeated = 1121;
  repeated self newValue_upper_no_underscore_message_repeated = 1122;

  repeated Foo new_val_lower_enum_repeated = 1123;
  repeated Foo new_Val_upper_enum_repeated = 1124;
  repeated Foo newvalue_lower_no_underscore_enum_repeated = 1125;
  repeated Foo newValue_upper_no_underscore_enum_repeated = 1126;

  optional string alloc_val_lower_complex = 1211;
  optional string alloc_Val_upper_complex = 1212;
  optional string allocvalue_lower_no_underscore_complex = 1213;
  optional string allocValue_upper_no_underscore_complex = 1214;

  optional int32 alloc_val_lower_primitive = 1215;
  optional int32 alloc_Val_upper_primitive = 1216;
  optional int32 allocvalue_lower_no_underscore_primitive = 1217;
  optional int32 allocValue_upper_no_underscore_primitive = 1218;

  optional self alloc_val_lower_message = 1219;
  optional self alloc_Val_upper_message = 1220;
  optional self allocvalue_lower_no_underscore_message = 1221;
  optional self allocValue_upper_no_underscore_message = 1222;

  optional Foo alloc_val_lower_enum = 1223;
  optional Foo alloc_Val_upper_enum = 1224;
  optional Foo allocvalue_lower_no_underscore_enum = 1225;
  optional Foo allocValue_upper_no_underscore_enum = 1226;

  repeated string alloc_val_lower_complex_repeated = 1311;
  repeated string alloc_Val_upper_complex_repeated = 1312;
  repeated string allocvalue_lower_no_underscore_complex_repeated = 1313;
  repeated string allocValue_upper_no_underscore_complex_repeated = 1314;

  repeated int32 alloc_val_lower_primitive_repeated = 1315;
  repeated int32 alloc_Val_upper_primitive_repeated = 1316;
  repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 1317;
  repeated int32 allocValue_upper_no_underscore_primitive_repeated = 1318;

  repeated self alloc_val_lower_message_repeated = 1319;
  repeated self alloc_Val_upper_message_repeated = 1320;
  repeated self allocvalue_lower_no_underscore_message_repeated = 1321;
  repeated self allocValue_upper_no_underscore_message_repeated = 1322;

  repeated Foo alloc_val_lower_enum_repeated = 1323;
  repeated Foo alloc_Val_upper_enum_repeated = 1324;
  repeated Foo allocvalue_lower_no_underscore_enum_repeated = 1325;
  repeated Foo allocValue_upper_no_underscore_enum_repeated = 1326;

  optional string copy_val_lower_complex = 1411;
  optional string copy_Val_upper_complex = 1412;
  optional string copyvalue_lower_no_underscore_complex = 1413;
  optional string copyValue_upper_no_underscore_complex = 1414;

  optional int32 copy_val_lower_primitive = 1415;
  optional int32 copy_Val_upper_primitive = 1416;
  optional int32 copyvalue_lower_no_underscore_primitive = 1417;
  optional int32 copyValue_upper_no_underscore_primitive = 1418;

  optional self copy_val_lower_message = 1419;
  optional self copy_Val_upper_message = 1420;
  optional self copyvalue_lower_no_underscore_message = 1421;
  optional self copyValue_upper_no_underscore_message = 1422;

  optional Foo copy_val_lower_enum = 1423;
  optional Foo copy_Val_upper_enum = 1424;
  optional Foo copyvalue_lower_no_underscore_enum = 1425;
  optional Foo copyValue_upper_no_underscore_enum = 1426;

  repeated string copy_val_lower_complex_repeated = 1511;
  repeated string copy_Val_upper_complex_repeated = 1512;
  repeated string copyvalue_lower_no_underscore_complex_repeated = 1513;
  repeated string copyValue_upper_no_underscore_complex_repeated = 1514;

  repeated int32 copy_val_lower_primitive_repeated = 1515;
  repeated int32 copy_Val_upper_primitive_repeated = 1516;
  repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 1517;
  repeated int32 copyValue_upper_no_underscore_primitive_repeated = 1518;

  repeated self copy_val_lower_message_repeated = 1519;
  repeated self copy_Val_upper_message_repeated = 1520;
  repeated self copyvalue_lower_no_underscore_message_repeated = 1521;
  repeated self copyValue_upper_no_underscore_message_repeated = 1522;

  repeated Foo copy_val_lower_enum_repeated = 1523;
  repeated Foo copy_Val_upper_enum_repeated = 1524;
  repeated Foo copyvalue_lower_no_underscore_enum_repeated = 1525;
  repeated Foo copyValue_upper_no_underscore_enum_repeated = 1526;

  optional string mutableCopy_val_lower_complex = 1611;
  optional string mutableCopy_Val_upper_complex = 1612;
  optional string mutableCopyvalue_lower_no_underscore_complex = 1613;
  optional string mutableCopyValue_upper_no_underscore_complex = 1614;

  optional int32 mutableCopy_val_lower_primitive = 1615;
  optional int32 mutableCopy_Val_upper_primitive = 1616;
  optional int32 mutableCopyvalue_lower_no_underscore_primitive = 1617;
  optional int32 mutableCopyValue_upper_no_underscore_primitive = 1618;

  optional self mutableCopy_val_lower_message = 1619;
  optional self mutableCopy_Val_upper_message = 1620;
  optional self mutableCopyvalue_lower_no_underscore_message = 1621;
  optional self mutableCopyValue_upper_no_underscore_message = 1622;

  optional Foo mutableCopy_val_lower_enum = 1623;
  optional Foo mutableCopy_Val_upper_enum = 1624;
  optional Foo mutableCopyvalue_lower_no_underscore_enum = 1625;
  optional Foo mutableCopyValue_upper_no_underscore_enum = 1626;

  repeated string mutableCopy_val_lower_complex_repeated = 1711;
  repeated string mutableCopy_Val_upper_complex_repeated = 1712;
  repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 1713;
  repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 1714;

  repeated int32 mutableCopy_val_lower_primitive_repeated = 1715;
  repeated int32 mutableCopy_Val_upper_primitive_repeated = 1716;
  repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 1717;
  repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 1718;

  repeated self mutableCopy_val_lower_message_repeated = 1719;
  repeated self mutableCopy_Val_upper_message_repeated = 1720;
  repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 1721;
  repeated self mutableCopyValue_upper_no_underscore_message_repeated = 1722;

  repeated Foo mutableCopy_val_lower_enum_repeated = 1723;
  repeated Foo mutableCopy_Val_upper_enum_repeated = 1724;
  repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 1725;
  repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 1726;
}

message JustToScopeExtensions {
  extend ObjCRetainedFoo {
    optional string new_val_lower_complex = 2011;
    optional string new_Val_upper_complex = 2012;
    optional string newvalue_lower_no_underscore_complex = 2013;
    optional string newValue_upper_no_underscore_complex = 2014;

    optional int32 new_val_lower_primitive = 2015;
    optional int32 new_Val_upper_primitive = 2016;
    optional int32 newvalue_lower_no_underscore_primitive = 2017;
    optional int32 newValue_upper_no_underscore_primitive = 2018;

    optional self new_val_lower_message = 2019;
    optional self new_Val_upper_message = 2020;
    optional self newvalue_lower_no_underscore_message = 2021;
    optional self newValue_upper_no_underscore_message = 2022;

    optional Foo new_val_lower_enum = 2023;
    optional Foo new_Val_upper_enum = 2024;
    optional Foo newvalue_lower_no_underscore_enum = 2025;
    optional Foo newValue_upper_no_underscore_enum = 2026;

    repeated string new_val_lower_complex_repeated = 2111;
    repeated string new_Val_upper_complex_repeated = 2112;
    repeated string newvalue_lower_no_underscore_complex_repeated = 2113;
    repeated string newValue_upper_no_underscore_complex_repeated = 2114;

    repeated int32 new_val_lower_primitive_repeated = 2115;
    repeated int32 new_Val_upper_primitive_repeated = 2116;
    repeated int32 newvalue_lower_no_underscore_primitive_repeated = 2117;
    repeated int32 newValue_upper_no_underscore_primitive_repeated = 2118;

    repeated self new_val_lower_message_repeated = 2119;
    repeated self new_Val_upper_message_repeated = 2120;
    repeated self newvalue_lower_no_underscore_message_repeated = 2121;
    repeated self newValue_upper_no_underscore_message_repeated = 2122;

    repeated Foo new_val_lower_enum_repeated = 2123;
    repeated Foo new_Val_upper_enum_repeated = 2124;
    repeated Foo newvalue_lower_no_underscore_enum_repeated = 2125;
    repeated Foo newValue_upper_no_underscore_enum_repeated = 2126;

    optional string alloc_val_lower_complex = 2211;
    optional string alloc_Val_upper_complex = 2212;
    optional string allocvalue_lower_no_underscore_complex = 2213;
    optional string allocValue_upper_no_underscore_complex = 2214;

    optional int32 alloc_val_lower_primitive = 2215;
    optional int32 alloc_Val_upper_primitive = 2216;
    optional int32 allocvalue_lower_no_underscore_primitive = 2217;
    optional int32 allocValue_upper_no_underscore_primitive = 2218;

    optional self alloc_val_lower_message = 2219;
    optional self alloc_Val_upper_message = 2220;
    optional self allocvalue_lower_no_underscore_message = 2221;
    optional self allocValue_upper_no_underscore_message = 2222;

    optional Foo alloc_val_lower_enum = 2223;
    optional Foo alloc_Val_upper_enum = 2224;
    optional Foo allocvalue_lower_no_underscore_enum = 2225;
    optional Foo allocValue_upper_no_underscore_enum = 2226;

    repeated string alloc_val_lower_complex_repeated = 2311;
    repeated string alloc_Val_upper_complex_repeated = 2312;
    repeated string allocvalue_lower_no_underscore_complex_repeated = 2313;
    repeated string allocValue_upper_no_underscore_complex_repeated = 2314;

    repeated int32 alloc_val_lower_primitive_repeated = 2315;
    repeated int32 alloc_Val_upper_primitive_repeated = 2316;
    repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 2317;
    repeated int32 allocValue_upper_no_underscore_primitive_repeated = 2318;

    repeated self alloc_val_lower_message_repeated = 2319;
    repeated self alloc_Val_upper_message_repeated = 2320;
    repeated self allocvalue_lower_no_underscore_message_repeated = 2321;
    repeated self allocValue_upper_no_underscore_message_repeated = 2322;

    repeated Foo alloc_val_lower_enum_repeated = 2323;
    repeated Foo alloc_Val_upper_enum_repeated = 2324;
    repeated Foo allocvalue_lower_no_underscore_enum_repeated = 2325;
    repeated Foo allocValue_upper_no_underscore_enum_repeated = 2326;

    optional string copy_val_lower_complex = 2411;
    optional string copy_Val_upper_complex = 2412;
    optional string copyvalue_lower_no_underscore_complex = 2413;
    optional string copyValue_upper_no_underscore_complex = 2414;

    optional int32 copy_val_lower_primitive = 2415;
    optional int32 copy_Val_upper_primitive = 2416;
    optional int32 copyvalue_lower_no_underscore_primitive = 2417;
    optional int32 copyValue_upper_no_underscore_primitive = 2418;

    optional self copy_val_lower_message = 2419;
    optional self copy_Val_upper_message = 2420;
    optional self copyvalue_lower_no_underscore_message = 2421;
    optional self copyValue_upper_no_underscore_message = 2422;

    optional Foo copy_val_lower_enum = 2423;
    optional Foo copy_Val_upper_enum = 2424;
    optional Foo copyvalue_lower_no_underscore_enum = 2425;
    optional Foo copyValue_upper_no_underscore_enum = 2426;

    repeated string copy_val_lower_complex_repeated = 2511;
    repeated string copy_Val_upper_complex_repeated = 2512;
    repeated string copyvalue_lower_no_underscore_complex_repeated = 2513;
    repeated string copyValue_upper_no_underscore_complex_repeated = 2514;

    repeated int32 copy_val_lower_primitive_repeated = 2515;
    repeated int32 copy_Val_upper_primitive_repeated = 2516;
    repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 2517;
    repeated int32 copyValue_upper_no_underscore_primitive_repeated = 2518;

    repeated self copy_val_lower_message_repeated = 2519;
    repeated self copy_Val_upper_message_repeated = 2520;
    repeated self copyvalue_lower_no_underscore_message_repeated = 2521;
    repeated self copyValue_upper_no_underscore_message_repeated = 2522;

    repeated Foo copy_val_lower_enum_repeated = 2523;
    repeated Foo copy_Val_upper_enum_repeated = 2524;
    repeated Foo copyvalue_lower_no_underscore_enum_repeated = 2525;
    repeated Foo copyValue_upper_no_underscore_enum_repeated = 2526;

    optional string mutableCopy_val_lower_complex = 2611;
    optional string mutableCopy_Val_upper_complex = 2612;
    optional string mutableCopyvalue_lower_no_underscore_complex = 2613;
    optional string mutableCopyValue_upper_no_underscore_complex = 2614;

    optional int32 mutableCopy_val_lower_primitive = 2615;
    optional int32 mutableCopy_Val_upper_primitive = 2616;
    optional int32 mutableCopyvalue_lower_no_underscore_primitive = 2617;
    optional int32 mutableCopyValue_upper_no_underscore_primitive = 2618;

    optional self mutableCopy_val_lower_message = 2619;
    optional self mutableCopy_Val_upper_message = 2620;
    optional self mutableCopyvalue_lower_no_underscore_message = 2621;
    optional self mutableCopyValue_upper_no_underscore_message = 2622;

    optional Foo mutableCopy_val_lower_enum = 2623;
    optional Foo mutableCopy_Val_upper_enum = 2624;
    optional Foo mutableCopyvalue_lower_no_underscore_enum = 2625;
    optional Foo mutableCopyValue_upper_no_underscore_enum = 2626;

    repeated string mutableCopy_val_lower_complex_repeated = 2711;
    repeated string mutableCopy_Val_upper_complex_repeated = 2712;
    repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 2713;
    repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 2714;

    repeated int32 mutableCopy_val_lower_primitive_repeated = 2715;
    repeated int32 mutableCopy_Val_upper_primitive_repeated = 2716;
    repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 2717;
    repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 2718;

    repeated self mutableCopy_val_lower_message_repeated = 2719;
    repeated self mutableCopy_Val_upper_message_repeated = 2720;
    repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 2721;
    repeated self mutableCopyValue_upper_no_underscore_message_repeated = 2722;

    repeated Foo mutableCopy_val_lower_enum_repeated = 2723;
    repeated Foo mutableCopy_Val_upper_enum_repeated = 2724;
    repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 2725;
    repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 2726;
  }
}

// Test handling of fields that are the retained names.
message ObjCRetainedComplex {
  optional string new = 1;
  optional string alloc = 2;
  optional string copy = 3;
  optional string mutableCopy = 4;
}

message ObjCRetainedComplexRepeated {
  repeated string new = 1;
  repeated string alloc = 2;
  repeated string copy = 3;
  repeated string mutableCopy = 4;
}

message ObjCRetainedPrimitive {
  optional int32 new = 1;
  optional int32 alloc = 2;
  optional int32 copy = 3;
  optional int32 mutableCopy = 4;
}

message ObjCRetainedPrimitiveRepeated {
  repeated int32 new = 1;
  repeated int32 alloc = 2;
  repeated int32 copy = 3;
  repeated int32 mutableCopy = 4;
}

message ObjCRetainedMessage {
  optional self new = 1;
  optional self alloc = 2;
  optional self copy = 3;
  optional self mutableCopy = 4;
}

message ObjCRetainedMessageRepeated {
  repeated self new = 1;
  repeated self alloc = 2;
  repeated self copy = 3;
  repeated self mutableCopy = 4;
}

// Test Handling some MacTypes
message Point {
  message Rect {
    optional int32 TimeValue = 1;
  }
}

// Test some weird defaults that we see in protos.
message ObjcWeirdDefaults {
  // Set default values that match the protocol buffer defined defaults to
  // confirm hasDefault and the default values are set correctly.
  optional string foo = 1 [default = ""];
  optional bytes bar = 2 [default = ""];
}

// Used to confirm negative enum values work as expected.
message EnumTestMsg {
  enum MyEnum {
    ZERO    = 0;
    ONE     = 1;
    TWO     = 2;
    NEG_ONE = -1;
    NEG_TWO = -2;
  }
  optional MyEnum foo = 1;
  optional MyEnum bar = 2 [default = ONE];
  optional MyEnum baz = 3 [default = NEG_ONE];

  repeated MyEnum mumble = 4;
}

// Test case for https://github.com/protocolbuffers/protobuf/issues/1453
// Message with no explicit defaults, but a non zero default for an enum.
message MessageWithOneBasedEnum {
  enum OneBasedEnum {
    ONE = 1;
    TWO = 2;
  }
  optional OneBasedEnum enum_field = 1;
}

// Message with all bools for testing things related to bool storage.
message BoolOnlyMessage {
  optional bool bool_field_1 = 1;
  optional bool bool_field_2 = 2;
  optional bool bool_field_3 = 3;
  optional bool bool_field_4 = 4;
  optional bool bool_field_5 = 5;
  optional bool bool_field_6 = 6;
  optional bool bool_field_7 = 7;
  optional bool bool_field_8 = 8;
  optional bool bool_field_9 = 9;
  optional bool bool_field_10 = 10;
  optional bool bool_field_11 = 11;
  optional bool bool_field_12 = 12;
  optional bool bool_field_13 = 13;
  optional bool bool_field_14 = 14;
  optional bool bool_field_15 = 15;
  optional bool bool_field_16 = 16;
  optional bool bool_field_17 = 17;
  optional bool bool_field_18 = 18;
  optional bool bool_field_19 = 19;
  optional bool bool_field_20 = 20;
  optional bool bool_field_21 = 21;
  optional bool bool_field_22 = 22;
  optional bool bool_field_23 = 23;
  optional bool bool_field_24 = 24;
  optional bool bool_field_25 = 25;
  optional bool bool_field_26 = 26;
  optional bool bool_field_27 = 27;
  optional bool bool_field_28 = 28;
  optional bool bool_field_29 = 29;
  optional bool bool_field_30 = 30;
  optional bool bool_field_31 = 31;
  optional bool bool_field_32 = 32;
}

// Reference to a WKT to test (via generated code inspection), the handling
// of #imports.  Within the WKTs, references to each other are just path
// based imports, but when reference from another proto file, they should be
// conditional to support the framework import style.
message WKTRefereceMessage {
  optional google.protobuf.Any an_any = 1;
}

// This is in part a compile test, it ensures that when aliases end up with
// the same ObjC name, we drop them to avoid the duplication names. There
// is a test to ensure the descriptors are still generated to support
// reflection and TextFormat.
enum TestEnumObjCNameCollision {
  option allow_alias = true;

  FOO = 1;
  foo = 1;

  BAR = 2;
  mumble = 2;
  MUMBLE = 2;
}