diff options
| author | Alasdair Armstrong | 2018-08-30 17:58:33 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-08-30 17:59:40 +0100 |
| commit | dee068786b2ef0b0d57fc02ca042e176c74db9b0 (patch) | |
| tree | 6be133c7a3269e513935dbe1e9dd70a559a78749 /test | |
| parent | 26d55b94f23f73ef9adf6a3031e48b84e724ac09 (diff) | |
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
Diffstat (limited to 'test')
| -rw-r--r-- | test/c/downcast_fn.expect | 1 | ||||
| -rw-r--r-- | test/c/downcast_fn.sail | 23 |
2 files changed, 24 insertions, 0 deletions
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 <flow.sail> + +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") +} |
