From 43baceb1ed01bdb4a4e0fb3eb46ef57b62c10401 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 21 Dec 2020 11:39:59 +0100 Subject: [PATCH] Test for recursion with modifiers. --- .../modifiers/modifer_recursive.sol | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/libsolidity/semanticTests/modifiers/modifer_recursive.sol diff --git a/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol b/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol new file mode 100644 index 000000000..d81ce78ed --- /dev/null +++ b/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol @@ -0,0 +1,17 @@ +contract C { + uint public called; + modifier mod1 { + called++; + _; + } + function f(uint x) public mod1 returns (uint256 r) { + return x == 0 ? 2 : f(x - 1)**2; + } +} + +// ==== +// compileViaYul: also +// ---- +// called() -> 0x00 +// f(uint256): 5 -> 0x0100000000 +// called() -> 6