diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index c0013a4..77fdd52 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -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, + [<> + ]) ]. -define(Path(File), "code_errors/" ??File). diff --git a/test/contracts/bad_protected_call.aes b/test/contracts/bad_protected_call.aes new file mode 100644 index 0000000..ba1f59c --- /dev/null +++ b/test/contracts/bad_protected_call.aes @@ -0,0 +1,6 @@ +contract Remote = + entrypoint id : int => int + +contract ProtectedCall = + entrypoint bad(r : Remote) = + r.id(protected = 0 == 1, 18) diff --git a/test/contracts/protected_call.aes b/test/contracts/protected_call.aes new file mode 100644 index 0000000..d377399 --- /dev/null +++ b/test/contracts/protected_call.aes @@ -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) +