Skip to content

Commit

Permalink
proto: fix HasPresence for extensions and missing plugin response
Browse files Browse the repository at this point in the history
Change-Id: I9ee81f7a88cf91f3041e89936cb03511bd224603
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/574375
Auto-Submit: Lasse Folger <lassefolger@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
  • Loading branch information
lfolger committed Mar 26, 2024
1 parent dea00b5 commit 3ebf7dd
Show file tree
Hide file tree
Showing 5 changed files with 732 additions and 399 deletions.
2 changes: 2 additions & 0 deletions cmd/protoc-gen-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func main() {
}
}
gen.SupportedFeatures = gengo.SupportedFeatures
gen.SupportedEditionsMinimum = gengo.SupportedEditionsMinimum
gen.SupportedEditionsMaximum = gengo.SupportedEditionsMaximum
return nil
})
}
2 changes: 1 addition & 1 deletion internal/filedesc/desc.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (fd *Field) HasPresence() bool {
if fd.L1.Cardinality == protoreflect.Repeated {
return false
}
return fd.L1.EditionFeatures.IsFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil
return fd.IsExtension() || fd.L1.EditionFeatures.IsFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil
}
func (fd *Field) HasOptionalKeyword() bool {
return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
Expand Down

0 comments on commit 3ebf7dd

Please sign in to comment.