janestreet / ppx_sexp_conv

Generation of S-expression conversion functions from type definitions
MIT License
88 stars 17 forks source link

Recursive types break codegen #40

Open mbacarella opened 2 years ago

mbacarella commented 2 years ago
type x = [ `A of b ]
and b = x [@@deriving sexp]

Now fails with

4 | and b = x [@@deriving sexp]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This kind of expression is not allowed as right-hand side of `let rec'

I'm pretty sure this used to work.

fpottier commented 1 year ago

Hello, I have just observed the same issue.

type program = P
and t = program
[@@deriving sexp]

This used to work with ppx_sexp_conv v0.14.1 and does not work any more with v0.15.1.

mjambon commented 1 year ago

Same problem for us in v0.15.1. v0.14.3 was fine.

mjambon commented 1 year ago

Our problem is that we're stuck with ppx_sexp_conv 0.14.3 which requires Base < 0.15.0. This older version of Base has another undesirable bug that was fixed in Base 0.15.1 (see https://github.com/janestreet/base/issues/146#issuecomment-1583087613) so we'd like to upgrade Base but we can't.

Note that we're phasing out our use of ppx_sexp_conv for other reasons, that's why I have limited motivation to fix this myself.

nmote commented 1 year ago

This appears to have been addressed with the v0.16.0 release