Is there a bug in treatment of int32 (zigzag)?
Closed this issue · 1 comments
chetmurthy commented
I'm re-implementing your PPX rewriter on top of pa_ppx, and found what appears to be a bug? The following type-decl:
type il2 = int32 [@encoding `zigzag] [@@deriving protobuf]
yields the following code (and analogous decoder code):
and il2_to_protobuf value encoder =
((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in
let alias = value in
(Protobuf.Encoder.key (1, Protobuf.Varint) encoder;
Protobuf.Encoder.zigzag (Int64.of_int32 alias) encoder);
())
[@ocaml.warning "-A"])
Is that right? Shouldn't the key be Protobuf.Zigzag
? I'm only now starting on this, so ... I could be very, very wrong. Just figured I'd better ask.
chetmurthy commented
O.i.c. Zigzag isn't in the protobuf spec. Closed.