Skip to content

Use negative UninterpretedOption field tags for interpreted option locations. - #29005

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_958626527
Draft

Use negative UninterpretedOption field tags for interpreted option locations.#29005
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_958626527

Conversation

@copybara-service

Copy link
Copy Markdown

Use negative UninterpretedOption field tags for interpreted option locations.

This allows us to extend improved SourceCodeInfo support to dot-notation options without breaking backwards compatibility. Dot-notation options like (my_opt).a = 123 already emit SourceCodeInfo location in a form of [..., 10101, 1] where 1 is the tag of field a. That location spans the whole option. But these pre-existing locations are limited as they don't provide granular information about each part of the option (e.g. location of a) and don't provide location for value too.

Using negative values allows us to create non-overlapping set of locations. For example in the example above we will emit (in future CL):

[..., 10101] - location of the whole (my_opt).a = 123 option
[..., 10101, 1] - legacy duplicate location of the whole (my_opt).a = 123 option
[..., 10101, -2] - location of (my_opt) part
[..., 10101, -8, 1, -2] - location of a part
[..., 10101, -8, 1, -4] - location of 123 part

@copybara-service
copybara-service Bot force-pushed the test_958626527 branch 2 times, most recently from 7ef1684 to 1a099ba Compare August 4, 2026 19:19
…cations.

This allows us to extend improved SourceCodeInfo support to dot-notation options without breaking backwards compatibility. Dot-notation options like `(my_opt).a = 123` already emit SourceCodeInfo location in a form of `[..., 10101, 1]` where 1 is the tag of field `a`. That location spans the whole option. But these pre-existing locations are limited as they don't provide granular information about each part of the option (e.g. location of `a`) and don't provide location for value too.

Using negative values allows us to create non-overlapping set of locations. For example in the example above we will emit (in future CL):

[..., 10101] - location of the whole `(my_opt).a = 123` option
[..., 10101, 1] - legacy duplicate location of the whole `(my_opt).a = 123` option
[..., 10101, -2] - location of `(my_opt)` part
[..., 10101, -8, 1, -2] - location of `a` part
[..., 10101, -8, 1, -4] - location of `123` part

PiperOrigin-RevId: 958626527
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant