more type annotations required in generated code
Closed this issue · 2 comments
agarwal commented
Issue #109 added type annotations to help the compiler in case of duplicate constructor names. In some cases, type annotations are needed in even more places. Here is a minimal example:
$ cat foo.proto
syntax = "proto3";
message A {
oneof x {
string value = 1;
string null = 2;
}
}
message B {
oneof x {
string value = 1;
string null = 2;
}
}
$ ocaml-protoc -yojson -ml_out . foo.proto
$ ocamlc -c foo_types.mli
$ ocamlc -c foo_types.ml
$ ocamlfind ocamlc -c -package ocaml-protoc-yojson foo_yojson.mli
$ ocamlfind ocamlc -c -package ocaml-protoc-yojson foo_yojson.ml
File "foo_yojson.ml", line 1:
Error: The implementation foo_yojson.ml
does not match the interface foo_yojson.cmi:
Values do not match:
val decode_a :
[> `Assoc of (string * Yojson.Basic.json) list ] -> Foo_types.b
is not included in
val decode_a : Yojson.Basic.json -> Foo_types.a
File "foo_yojson.ml", line 4, characters 8-16: Actual declaration
make: *** [all] Error 2
mransan commented
@agarwal it should be fixed now! let me know if it works Ok. Thanks for the small and easy to reproduce example!
agarwal commented
Looks good. Thanks for the fix!