Nim/tests/dll/nimhcr_2_1.nim
Viktor Kirilov 5df7d72afe HCR: tests for the fixes for #11608 and #11996 (#12047)
* tests for #11996 and #11608

* removed unnecessary comment
2019-08-26 20:08:18 +02:00

30 lines
676 B
Nim

import hotcodereloading
type
Type2 = ref object of RootObj
data*: int
let g_2* = @[Type2(data: 2), Type2(data: 3)][1..^1] # should have a length of 1
var a: tuple[str: string, i: int]
a.str = " 2: random string"
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)