Looking at
|
-- | 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 -> Maybe RawPrimitive |
|
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.
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
lastMaythere.