sophia/test/contracts/warnings.aes
Gaith Hallak 31fd8fe24f
Hide warning when calling with non-0 value arg (#431)
* Hide warning when calling with non-0 value arg

* Update the tests

* Update CHANGELOG
2022-12-12 11:44:24 +03:00

68 lines
1.5 KiB
Plaintext

// Used include
include "Pair.aes"
// Unused include
include "Triple.aes"
namespace UnusedNamespace =
function f() = 1 + g()
// Used in f
private function g() = 2
// Unused
private function h() = 3
main contract Warnings =
type state = int
type unused_type = bool
entrypoint init(p) = Pair.fst(p) + Pair.snd(p)
stateful entrypoint negative_spend(to : address) = Chain.spend(to, -1)
entrypoint shadowing() =
let x = 1
let x = 2
x
entrypoint division_by_zero(x) = x / 0
stateful entrypoint unused_stateful() = 1
stateful entrypoint used_stateful(x : int) = put(x)
entrypoint unused_variables(unused_arg : int) =
let unused_var = 10
let z = 20
z
// Unused functions
function unused_function() = ()
function recursive_unused_function() = recursive_unused_function()
function called_unused_function1() = called_unused_function2()
function called_unused_function2() = called_unused_function1()
function rv() = 1
entrypoint unused_return_value() =
rv()
2
namespace FunctionsAsArgs =
function f() = g()
private function g() = h(inc)
private function h(fn : (int => int)) = fn(1)
// Passed as arg to h in g
private function inc(n : int) : int = n + 1
// Never used
private function dec(n : int) : int = n - 1
contract Remote =
entrypoint id(_) = 0
contract C =
payable stateful entrypoint
call_missing_con() : int = (ct_1111111111111111111111111111112JF6Dz72 : Remote).id(value = 1, 0)