From 4e44664336e60be5bbc6f4305217cf0987ae0c95 Mon Sep 17 00:00:00 2001 From: cyberthirst Date: Fri, 2 Aug 2024 13:03:48 +0200 Subject: [PATCH] add test for recursive call --- .../analysis/test_cyclic_function_calls.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/unit/semantics/analysis/test_cyclic_function_calls.py b/tests/unit/semantics/analysis/test_cyclic_function_calls.py index 990c839fde..009d3bc91e 100644 --- a/tests/unit/semantics/analysis/test_cyclic_function_calls.py +++ b/tests/unit/semantics/analysis/test_cyclic_function_calls.py @@ -54,6 +54,21 @@ def potato(): analyze_module(vyper_module, dummy_input_bundle) +def test_recursive_function_call(dummy_input_bundle): + code = """ +@external +def foo(): + self.bar() + +@internal +def bar(): + self.bar() + """ + vyper_module = parse_to_ast(code) + with pytest.raises(CallViolation): + analyze_module(vyper_module, dummy_input_bundle) + + def test_global_ann_assign_callable_no_crash(dummy_input_bundle): code = """ balanceOf: public(HashMap[address, uint256])