Fail gracefully on higher-order state in AEVM and accept it in FATE

This commit is contained in:
Ulf Norell
2019-09-03 17:24:40 +02:00
parent 325d69e96d
commit 602e99512f
5 changed files with 26 additions and 5 deletions
+4
View File
@@ -601,5 +601,9 @@ failing_code_gen_contracts() ->
"Invalid oracle type\n"
" oracle(string, (int) => int)\n"
"The response type must not be higher-order (contain function types).")
, ?AEVM(higher_order_state, 3, 3,
"Invalid state type\n"
" {f : (int) => int}\n"
"The state cannot contain functions in the AEVM. Use FATE if you need this.")
].
@@ -0,0 +1,7 @@
contract HigherOrderState =
record state = {f : int => int}
entrypoint init() = {f = (x) => x}
entrypoint apply(n) = state.f(n)
stateful entrypoint inc() = put(state{ f = (x) => state.f(x + 1) })