1// Protocol Buffers - Google's data interchange format 2// Copyright 2023 Google LLC. All rights reserved. 3// 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file or at 6// https://developers.google.com/open-source/licenses/bsd 7 8// LINT: LEGACY_NAMES 9 10// The purpose of this file is to be hostile on field/message/enum naming and 11// ensure that it works (e.g. collisions between names and language keywords, 12// collisions between two different field's accessor's names). 13 14syntax = "proto2"; 15 16// Note: Ideally this test could be 'package type.if.else.true.false' 17// which would work in Rust but would break the C++ codegen. 18 19package type.type; 20 21message Self { 22 optional int32 for = 1; 23 optional Self self = 2; 24 optional bool true = 3; 25 optional string false = 4; 26} 27 28message Pub { 29 enum Self { 30 enum = 0; 31 } 32} 33 34message enum {} 35 36message Ref { 37 oneof self { 38 .type.type.Pub.Self const = 3; 39 } 40} 41 42// A message where the accessors would collide that should still work. Note that 43// not all collisions problems are avoided, not least because C++ Proto does not 44// avoid all possible collisions (eg a field `x` and `clear_x` will often not 45// compile on C++). 46message AccessorsCollide { 47 message X {} 48 message SetX {} 49 optional SetX set_x = 2; 50 optional X x = 3; 51 oneof o { 52 bool x_mut = 5; 53 } 54} 55