From 5df7d72afe28fb332ad5205377d56b05245e54a9 Mon Sep 17 00:00:00 2001 From: Viktor Kirilov Date: Mon, 26 Aug 2019 21:08:18 +0300 Subject: [PATCH] HCR: tests for the fixes for #11608 and #11996 (#12047) * tests for #11996 and #11608 * removed unnecessary comment --- tests/dll/nimhcr_2_1.nim | 15 +++++++++++++++ tests/dll/nimhcr_integration.nim | 1 + 2 files changed, 16 insertions(+) diff --git a/tests/dll/nimhcr_2_1.nim b/tests/dll/nimhcr_2_1.nim index a13b4c681..faafb1f76 100644 --- a/tests/dll/nimhcr_2_1.nim +++ b/tests/dll/nimhcr_2_1.nim @@ -13,3 +13,18 @@ echo a.str beforeCodeReload: echo " 2: before!" + +# testing a construct of 2 functions in the same module which reference each other +# https://github.com/nim-lang/Nim/issues/11608 +proc rec_1(depth: int) +proc rec_2(depth: int) = + rec_1(depth + 1) +proc rec_1(depth: int) = + if depth < 3: + rec_2(depth) + else: + echo("max mutual recursion reached!") + +# https://github.com/nim-lang/Nim/issues/11996 +let rec_2_func_ref = rec_2 +rec_2_func_ref(0) diff --git a/tests/dll/nimhcr_integration.nim b/tests/dll/nimhcr_integration.nim index 40ba90f72..9bae64ef4 100644 --- a/tests/dll/nimhcr_integration.nim +++ b/tests/dll/nimhcr_integration.nim @@ -29,6 +29,7 @@ main: hasAnyModuleChanged? true 0: before - improved! main: before 2: random string +max mutual recursion reached! 1 bar 0: after - closure iterator: 0