Browse Source

add test (closes #3681)

Simon Krajewski 10 years ago
parent
commit
6f9023b682
1 changed files with 27 additions and 0 deletions
  1. 27 0
      tests/unit/src/unit/issues/Issue3681.hx

+ 27 - 0
tests/unit/src/unit/issues/Issue3681.hx

@@ -0,0 +1,27 @@
+package unit.issues;
+
+private class Node<T>
+{
+    public var cur:T;
+    public var next:Null<Node<T>>;
+    public function new(cur,?next)
+    {
+        this.cur = cur;
+        this.next = next;
+    }
+}
+
+class Issue3681 extends Test {
+	function test() {
+        var i:Null<Int> = null;
+        var nodes = new Node(i,new Node(1,new Node(2, new Node(i))));
+        var matches = switch (nodes)
+        {
+            case { cur : null, next : ({ cur : 1, next : _ }) }:
+                true;
+            case _:
+                false;
+        }
+        t(matches);
+	}
+}