-
-
Notifications
You must be signed in to change notification settings - Fork 365
Description
14:41:51 ~/Documents/GitHub/roc main $ roc test/fx/direct_recursive_variant.roc
Recursion via List: Tree.Node("div", [<tag_union variant=1>])
Roc crashed: e_tag: unexpected layout type
app [main!] { pf: platform "./platform/main.roc" }
import pf.Stdout
## Bug: Direct recursive reference in tag union variant crashes interpreter
##
## Error: "Roc crashed: e_tag: unexpected layout type"
##
## When a recursive type has a variant containing a direct reference to itself
## (not through a container like List), instantiating that variant crashes.
Tree := [
Node(Str, List(Tree)), # Recursive through List - OK
Text(Str),
Wrapper(Tree), # Direct recursive reference - CRASHES
]
main! = || {
# This works - recursion through List is fine
via_list : Tree
via_list = Node("div", [Text("hello")])
Stdout.line!("Recursion via List: ${Str.inspect(via_list)}")
inner : Tree
inner = Text("inner")
direct : Tree
direct = Wrapper(inner)
# This crashes - direct recursive reference
# Roc crashed: e_tag: unexpected layout type
Stdout.line!("Direct recursion: ${Str.inspect(direct)}")
}
Metadata
Metadata
Assignees
Labels
No labels