rescript-labs / decco

Bucklescript PPX which generates JSON (de)serializers for user-defined types
MIT License
226 stars 27 forks source link

Mutually recursive types #45

Closed jchavarri closed 4 years ago

jchavarri commented 4 years ago

It seems that single recursive types are supported since #31, but mutually recursive types using and are not.

Repro:

[@decco] type inttree =
  | Empty
  | Node(node)
[@decco] and node = {
  value: int,
  left: inttree,
  right: inttree,
};

It triggers an error The value node_encode can't be found.

I believe that encoders/decoders should also be declared with and so they can call each other.