Files
mgmt/lang/interpret_test/TestAstFunc1/recursive_class2.txtar
2023-06-01 16:56:44 -04:00

28 lines
735 B
Plaintext

-- main.mcl --
# this currently fails with: "class `c1` does not exist in this scope"
# instead of: "recursive class `c1` found" or "recursive class `c2` found"
# ideally, we'd consider allowing finite (static) recursion such as this...
import "fmt"
$max = 5
include c1(0) # start at zero
class c1($count) {
if $count == $max {
test "done" {
stringptr => fmt.printf("count is %d", $count),
}
} else {
include c2($count + 1) # recursion not supported atm
}
}
class c2($count) {
if $count == $max {
test "done" {
stringptr => fmt.printf("count is %d", $count),
}
} else {
include c1($count + 1) # recursion not supported atm
}
}
-- OUTPUT --
# err: errSetScope: recursive reference while setting scope: not a dag