From 5a33eab7bc05f45cde76253f84e139b2428fbbe7 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Mon, 29 Jan 2018 14:37:59 +0000 Subject: Fix a bug where structs containing unions would generate bad to_string functions Added a regression test in test/ocaml/string_of_struct --- test/ocaml/string_of_struct/expect | 0 test/ocaml/string_of_struct/sos.sail | 17 +++++++++++++++++ test/ocaml/string_of_struct/test.isail | 4 ++++ 3 files changed, 21 insertions(+) create mode 100644 test/ocaml/string_of_struct/expect create mode 100644 test/ocaml/string_of_struct/sos.sail create mode 100644 test/ocaml/string_of_struct/test.isail (limited to 'test/ocaml/string_of_struct') diff --git a/test/ocaml/string_of_struct/expect b/test/ocaml/string_of_struct/expect new file mode 100644 index 00000000..e69de29b diff --git a/test/ocaml/string_of_struct/sos.sail b/test/ocaml/string_of_struct/sos.sail new file mode 100644 index 00000000..6d14dfd7 --- /dev/null +++ b/test/ocaml/string_of_struct/sos.sail @@ -0,0 +1,17 @@ +/* This is a regression test for a bug where an option type in a +struct would cause the ocaml backend to generate a bad string_of +function for the struct */ + +union option ('a : Type) = { + None, + Some : 'a +} + +struct test = { + test1 : int, + test2 : option(int) +} + +val main : unit -> unit + +function main () = () \ No newline at end of file diff --git a/test/ocaml/string_of_struct/test.isail b/test/ocaml/string_of_struct/test.isail new file mode 100644 index 00000000..6a9595e3 --- /dev/null +++ b/test/ocaml/string_of_struct/test.isail @@ -0,0 +1,4 @@ +:output result +main() +:run +:quit \ No newline at end of file -- cgit v1.2.3