You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--| To comply with the protobuf spec, if there are multiple fields with the same
-- field number, this will always return the last one.
parsedField::RawField->MaybeRawPrimitive
parsedField xs =case xs of
[]->Nothing
(x:_) ->Just x
It says "To comply with the protobuf spec, if there are multiple fields with the same field number, this will always return the last one" and then returns the first one. That seems to be an optimisation from @gbaz. Was that intentional? If so, perhaps update the comment? If not, perhaps update the code? Our optimised version used lastMay there.
The text was updated successfully, but these errors were encountered:
If that''s the case, we should document it on the RawField type, and update the comment to parsedField. Might be worth adding a test though, since changing it to be the last doesn't seem to break anything for me.
Looking at
proto3-wire/src/Proto3/Wire/Decode.hs
Lines 288 to 293 in 43d8220
It says "To comply with the protobuf spec, if there are multiple fields with the same field number, this will always return the last one" and then returns the first one. That seems to be an optimisation from @gbaz. Was that intentional? If so, perhaps update the comment? If not, perhaps update the code? Our optimised version used
lastMay
there.The text was updated successfully, but these errors were encountered: