1*1c12ee1eSDan Willemsen// Copyright 2018 The Go Authors. All rights reserved. 2*1c12ee1eSDan Willemsen// Use of this source code is governed by a BSD-style 3*1c12ee1eSDan Willemsen// license that can be found in the LICENSE file. 4*1c12ee1eSDan Willemsen 5*1c12ee1eSDan Willemsensyntax = "proto2"; 6*1c12ee1eSDan Willemsen 7*1c12ee1eSDan Willemsenpackage goproto.protoc.fieldnames; 8*1c12ee1eSDan Willemsen 9*1c12ee1eSDan Willemsenoption go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames"; 10*1c12ee1eSDan Willemsen 11*1c12ee1eSDan Willemsen// Assorted edge cases in field name conflict resolution. 12*1c12ee1eSDan Willemsen// 13*1c12ee1eSDan Willemsen// Not all (or possibly any) of these behave in an easily-understood fashion. 14*1c12ee1eSDan Willemsen// This exists to demonstrate the current behavior and catch unintended 15*1c12ee1eSDan Willemsen// changes in it. 16*1c12ee1eSDan Willemsenmessage Message { 17*1c12ee1eSDan Willemsen // Various CamelCase conversions. 18*1c12ee1eSDan Willemsen optional string field_one = 1; 19*1c12ee1eSDan Willemsen optional string FieldTwo = 2; 20*1c12ee1eSDan Willemsen optional string fieldThree = 3; 21*1c12ee1eSDan Willemsen optional string field__four = 4; 22*1c12ee1eSDan Willemsen 23*1c12ee1eSDan Willemsen // Field names that conflict with standard methods on the message struct. 24*1c12ee1eSDan Willemsen optional string descriptor = 10; 25*1c12ee1eSDan Willemsen optional string marshal = 11; 26*1c12ee1eSDan Willemsen optional string unmarshal = 12; 27*1c12ee1eSDan Willemsen optional string proto_message = 13; 28*1c12ee1eSDan Willemsen 29*1c12ee1eSDan Willemsen // Field names that conflict with each other after CamelCasing. 30*1c12ee1eSDan Willemsen optional string CamelCase = 20; 31*1c12ee1eSDan Willemsen optional string CamelCase_ = 21; 32*1c12ee1eSDan Willemsen optional string camel_case = 22; // conflicts with 20, 21 33*1c12ee1eSDan Willemsen optional string CamelCase__ = 23; // conflicts with 21, 21, renamed 22 34*1c12ee1eSDan Willemsen 35*1c12ee1eSDan Willemsen // Field with a getter that conflicts with another field. 36*1c12ee1eSDan Willemsen optional string get_name = 30; 37*1c12ee1eSDan Willemsen optional string name = 31; 38*1c12ee1eSDan Willemsen 39*1c12ee1eSDan Willemsen // Oneof that conflicts with its first field: The oneof is renamed. 40*1c12ee1eSDan Willemsen oneof oneof_conflict_a { 41*1c12ee1eSDan Willemsen string OneofConflictA = 40; 42*1c12ee1eSDan Willemsen } 43*1c12ee1eSDan Willemsen 44*1c12ee1eSDan Willemsen // Oneof that conflicts with its second field: The field is renamed. 45*1c12ee1eSDan Willemsen oneof oneof_conflict_b { 46*1c12ee1eSDan Willemsen string oneof_no_conflict = 50; 47*1c12ee1eSDan Willemsen string OneofConflictB = 51; 48*1c12ee1eSDan Willemsen } 49*1c12ee1eSDan Willemsen 50*1c12ee1eSDan Willemsen // Oneof with a field name that conflicts with a nested message. 51*1c12ee1eSDan Willemsen oneof oneof_conflict_c { 52*1c12ee1eSDan Willemsen string oneof_message_conflict = 60; 53*1c12ee1eSDan Willemsen } 54*1c12ee1eSDan Willemsen message OneofMessageConflict {} 55*1c12ee1eSDan Willemsen} 56