Skip to content

Fix a few more conformance issues#693

Merged
doriable merged 4 commits intomainfrom
more-conformance-fixes
Apr 6, 2026
Merged

Fix a few more conformance issues#693
doriable merged 4 commits intomainfrom
more-conformance-fixes

Conversation

@doriable
Copy link
Copy Markdown
Member

@doriable doriable commented Mar 30, 2026

This PR fixes a couple more conformance issues found through the broader test suite:

  • A bug in fdp where comments attribution should be checking for R{Paren,Bracket,Brace} rather than L{Paren,Bracket,Brace}
  • A bug in fdp where the wrong tag was used for message extensions
  • proto3_optional should be set on a field for explicit presence, covering the case of optional extensions in proto3
  • A small bug in ir_test.go where the source code info location should set trailing comments
  • We fixed allowing prefixed group fields in the lexer, but we also need to handle the prefix in the lowering step for prefixed group fields
  • Fix a TODO to resolve group fields

This PR fixes a couple more conformance issues found through the broader
test suite:
- A bug in `fdp` where comments attribution should be checking for
  `R{Paren,Bracket,Brace}` rather than `L{Paren,Bracket,Brace}`
- `proto3_optional` should be set on a field for explicit presence
- A small bug in `ir_test.go` where the source code info location should
  set trailing comments
- We fixed allowing prefixed group fields in the lexer, but we also need
  to handle the prefix in the lowering step for prefixed group fields
- Fix a `TODO` to resolve group fields
@doriable doriable requested a review from mcy March 30, 2026 22:02
Copy link
Copy Markdown
Member

@mcy mcy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u make sure theres regression tests for everything

if label == presence.Explicit && g.currentFile.Syntax() == syntax.Proto3 {
// For proto3, if the presence is set explicitly with "optional", we need to set
// "proto3_optional" field to true.
fdp.Proto3Optional = addr(true)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how on earth did i miss this lmao

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhh, so technically you didn't ^^"

fdp.Proto3Optional = addr(true)

But this doesn't cover extensions that are optional in valid proto3 extension blocks, so this just moves the setting of this to field and the extend/proto3.proto test case has been extended to cover it.

@doriable
Copy link
Copy Markdown
Member Author

doriable commented Apr 2, 2026

Can u make sure theres regression tests for everything

Pushed up a new test case, simple.proto for the comment attribution that checks for the simple case that is addressed by the left -> right paren/bracket/brace fix addresses.

The group case is covered by the change to the group golden -- I should've caught that earlier, but the presence is now correctly set there.

Extended the extend/proto3.proto test to cover the case of optional extension fields in proto3. This matches protoc in that no synthetic one-of is created, but the extension is still marked as proto3_optional: true.

@doriable doriable merged commit b06501d into main Apr 6, 2026
7 checks passed
@doriable doriable deleted the more-conformance-fixes branch April 6, 2026 18:44
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.

2 participants