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