From dee068786b2ef0b0d57fc02ca042e176c74db9b0 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 30 Aug 2018 17:58:33 +0100 Subject: C: Fix a bug where function argument type becomes more specific due to flow typing Added a regression test as c/test/downcast_fn.sail --- test/c/downcast_fn.expect | 1 + test/c/downcast_fn.sail | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 test/c/downcast_fn.expect create mode 100644 test/c/downcast_fn.sail (limited to 'test') diff --git a/test/c/downcast_fn.expect b/test/c/downcast_fn.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/downcast_fn.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/downcast_fn.sail b/test/c/downcast_fn.sail new file mode 100644 index 00000000..d4b8ae5d --- /dev/null +++ b/test/c/downcast_fn.sail @@ -0,0 +1,23 @@ +default Order dec + +$include + +val f1 : forall 'n, 0 < 'n <= 8. int('n) -> unit + +function f1(_) = () + +val f2 : forall 'n, 'n > 0. int('n) -> unit + +function f2(width) = + if 'n <= 8 then + f1(width) + else () + +val "print" : string -> unit + +val main : unit -> unit + +function main() = { + f2(3); + print("ok\n") +} -- cgit v1.2.3