-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
In this haxe code:
class Test {
static public function main() {
var myTree = Tree.Node(Tree.Leaf("foo"), Tree.Node(Tree.Leaf("bar"), Tree.Leaf("foobar")));
var match = switch (myTree) {
case Tree.Leaf(_): "0";
case Tree.Node(_, Tree.Leaf(_)): "1";
case Tree.Node(_, Tree.Node(Tree.Leaf("bar"), _)): "2";
case _: "3";
}
trace(match); // 2
}
}
enum Tree {
Leaf(v:String);
Node(l:Tree, r:Tree);
}The result should be 2. But for some reason in polymod it gives 1 back. Not sure what the cause is 100%, but it seems it's about the nested matching not working properly.
The manual might explain better this behavior: https://haxe.org/manual/lf-pattern-matching-enums.html
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels