encoding/protobuf: respect lexical scoping rules#4325
Open
SteveRuble wants to merge 1 commit into
Open
Conversation
a5c350b to
526cb64
Compare
This change modifies the protobuf converter to respect lexical scoping when resolving relative references. Previously, relative references were resolved using the top-level scope, which meant that references which were not fully-qualified would fail to resolve. This change modifies the logic so that it searches for the first element of the reference name by iterating up the scope chain until it finds a match. This extends the existing .proto file used for testing references to include a variety of reference types, including relative, fully-qualified, and ambiguous references. It does NOT fix the existing bug where non-fully-qualified references to shadowed names end up always resolving to the shadowed name in the generated CUE, because changing that would require making the generated code opt in to the experimental aliasv2 feature, which may not be desirabled for all users. This also fixes a bug in the proto generation tests where the diff for golden files was reversed, leading to confusing test failure messages. This work used LLM-powered tab completion. Fixes cue-lang#4323 Signed-off-by: SteveRuble <SteveRuble@users.noreply.github.com>
526cb64 to
27dd3ac
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change modifies the protobuf converter to
respect lexical scoping when resolving relative
references. Previously, relative references were
resolved using the top-level scope, which meant
that references which were not fully-qualified
would fail to resolve. This change modifies the
logic so that it searches for the first element
of the reference name by iterating up the scope
chain until it finds a match.
This extends the existing .proto file used for
testing references to include a variety of
reference types, including relative,
fully-qualified, and ambiguous references.
It does NOT fix the existing bug where
non-fully-qualified references to shadowed
names end up always resolving to the shadowed
name in the generated CUE, because changing that
would require making the generated code opt in
to the experimental aliasv2 feature, which may
not be desirabled for all users.
This also fixes a bug in the proto generation
tests where the diff for golden files was
reversed, leading to confusing test failure
messages.
This work used LLM-powered tab completion,
but no other LLM tools.
Fixes #4323