Commit 7217580
authored
resolve oneof field name conflicts with imported packages (#1947)
Include oneof field names in conflict detection to properly generate
_root_ prefixes when oneof fields conflict with imported package names.
This fixes issue #1911 where ScalaPB would generate incorrect import
paths for oneof fields that conflict with imported package names.
The fix includes:
- Enhanced conflict detection in DescriptorImplicits.scala to include oneof field names
- Updated ProtobufGenerator.scala to properly handle conflicts when generating imports
- Added comprehensive tests to verify the fix works correctly
- Fixed test file to use correct generated class name (OneofImportConflictTest)
Closes #19111 parent 07b7799 commit 7217580
File tree
5 files changed
+110
-10
lines changed- compiler-plugin/src/main/scala/scalapb/compiler
- e2e/src
- main/protobuf
- location/v1
- test/scala
5 files changed
+110
-10
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
391 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
392 | 393 | | |
393 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
394 | 397 | | |
395 | 398 | | |
396 | 399 | | |
| |||
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
191 | 193 | | |
192 | | - | |
| 194 | + | |
193 | 195 | | |
| 196 | + | |
| 197 | + | |
194 | 198 | | |
195 | | - | |
| 199 | + | |
196 | 200 | | |
197 | 201 | | |
198 | 202 | | |
| |||
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
220 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
221 | 229 | | |
| 230 | + | |
| 231 | + | |
222 | 232 | | |
223 | 233 | | |
224 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
225 | 239 | | |
226 | | - | |
227 | 240 | | |
228 | 241 | | |
229 | 242 | | |
| |||
289 | 302 | | |
290 | 303 | | |
291 | 304 | | |
292 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
293 | 310 | | |
| 311 | + | |
| 312 | + | |
294 | 313 | | |
295 | 314 | | |
296 | 315 | | |
297 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
298 | 319 | | |
299 | 320 | | |
300 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments