diff options
| author | Alasdair Armstrong | 2018-01-29 14:37:59 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-01-29 14:37:59 +0000 |
| commit | 5a33eab7bc05f45cde76253f84e139b2428fbbe7 (patch) | |
| tree | 8ab1ecfc3154133561550d4bf6686bc105d62a01 /src | |
| parent | 0258cb243bcd63fe81ff761c12def9f71048e3db (diff) | |
Fix a bug where structs containing unions would generate bad to_string functions
Added a regression test in test/ocaml/string_of_struct
Diffstat (limited to 'src')
| -rw-r--r-- | src/ocaml_backend.ml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ocaml_backend.ml b/src/ocaml_backend.ml index 96dfd9d3..c535554b 100644 --- a/src/ocaml_backend.ml +++ b/src/ocaml_backend.ml @@ -528,7 +528,7 @@ let ocaml_string_of_enum ctx id ids = let ocaml_string_of_struct ctx id typq fields = let arg = gensym () in let ocaml_field (typ, id) = - separate space [string (string_of_id id ^ " = \""); string "^"; ocaml_string_typ typ arg ^^ string "." ^^ zencode ctx id] + separate space [string (string_of_id id ^ " = \""); string "^"; ocaml_string_typ typ (arg ^^ string "." ^^ zencode ctx id)] in separate space [string "let"; ocaml_string_of id; parens (arg ^^ space ^^ colon ^^ space ^^ zencode ctx id); equals] ^//^ (string "\"{" ^^ separate_map (hardline ^^ string "^ \", ") ocaml_field fields ^^ string " ^ \"}\"") |
