Add support for protected contract calls #732
@ -169,12 +169,13 @@ compilable_contracts() ->
|
||||
"qualified_constructor",
|
||||
"let_patterns",
|
||||
"lhs_matching",
|
||||
"more_strings"
|
||||
"more_strings",
|
||||
"protected_call"
|
||||
].
|
||||
|
||||
not_yet_compilable(fate) -> [];
|
||||
not_yet_compilable(aevm) -> ["pairing_crypto", "aens_update", "basic_auth_tx", "more_strings",
|
||||
"unapplied_builtins", "bytes_to_x", "state_handling"].
|
||||
"unapplied_builtins", "bytes_to_x", "state_handling", "protected_call"].
|
||||
|
||||
%% Contracts that should produce type errors
|
||||
|
||||
@ -632,6 +633,12 @@ failing_contracts() ->
|
||||
"Empty record/map update\n"
|
||||
" r {}">>
|
||||
])
|
||||
, ?TYPE_ERROR(bad_protected_call,
|
||||
[<<?Pos(6, 22)
|
||||
"Invalid 'protected' argument\n"
|
||||
" (0 : int) == (1 : int) : bool\n"
|
||||
"It must be either 'true' or 'false'.">>
|
||||
])
|
||||
].
|
||||
|
||||
-define(Path(File), "code_errors/" ??File).
|
||||
|
6
test/contracts/bad_protected_call.aes
Normal file
6
test/contracts/bad_protected_call.aes
Normal file
@ -0,0 +1,6 @@
|
||||
contract Remote =
|
||||
entrypoint id : int => int
|
||||
|
||||
contract ProtectedCall =
|
||||
entrypoint bad(r : Remote) =
|
||||
r.id(protected = 0 == 1, 18)
|
14
test/contracts/protected_call.aes
Normal file
14
test/contracts/protected_call.aes
Normal file
@ -0,0 +1,14 @@
|
||||
contract Remote =
|
||||
entrypoint id : int => int
|
||||
|
||||
contract ProtectedCall =
|
||||
|
||||
function higher_order(r : Remote) =
|
||||
r.id
|
||||
|
||||
entrypoint test_ok(r : Remote) =
|
||||
let f = higher_order(r)
|
||||
let Some(n) = r.id(protected = true, 10)
|
||||
let Some(m) = f(protected = true, 5)
|
||||
n + m + r.id(protected = false, 100) + f(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user