This issue may be related to #9632.
The following code causes a stack overflow at compile time:
BinarySearchTree := [Nil, Node({ value : U64, left : BinarySearchTree, right : BinarySearchTree })]
tree : U64 -> BinarySearchTree
tree = |v| {
Node({
left: Nil,
right: Nil,
value: v
})
}
main! = |_args| {
expected = Node({
left: Nil,
right: Nil,
value: 123
})
result = tree(123) == expected
echo!(Str.inspect(result))
Ok({})
}
The message is:
The Roc compiler overflowed its stack memory and had to exit.
Interestingly, if I comment out the type spec of the tree function, then the problem disappears. Also, the code works if I don't use ==.
This issue may be related to #9632.
The following code causes a stack overflow at compile time:
The message is:
Interestingly, if I comment out the type spec of the
treefunction, then the problem disappears. Also, the code works if I don't use==.