-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't qualify oneof type name when it doesn't share a name with its e…
…nclosing type (#82)
- Loading branch information
1 parent
7457803
commit 8a30fc5
Showing
3 changed files
with
54 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.../runtime-tests/src/main/proto/com/toasttab/protokt/testing/rt/oneof/oneof_exercises.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2020 Toast Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
syntax = "proto3"; | ||
|
||
package com.toasttab.protokt.testing.rt.oneof; | ||
|
||
// This file exercises oneofs whose names are the same as their | ||
// generated sealed class type names. If the code generator does | ||
// not handle them properly then compilation will fail. | ||
|
||
message OneofExerciseModel { | ||
oneof oneof { | ||
// Needs partial qualification: OneofExerciseModel.Model | ||
Model model = 1; | ||
} | ||
|
||
oneof oneof2 { | ||
// Does not need partial qualification: Model | ||
// This will still compile if qualified but may show a warning in IDEs | ||
Model not_named_model = 2; | ||
} | ||
|
||
message Model { | ||
bytes id = 1; | ||
} | ||
} | ||
|
||
message OneofExerciseModel2 { | ||
oneof oneof { | ||
// Needs full qualification: com.toasttab.protokt.testing.rt.oneof.OneofExerciseModel | ||
OneofExerciseModel oneof_exercise_model = 1; | ||
} | ||
} |