Simon Krajewski 4 лет назад
Родитель
Сommit
3f1bc02f36
1 измененных файлов с 25 добавлено и 0 удалено
  1. 25 0
      tests/unit/src/unit/issues/Issue10291.hx

+ 25 - 0
tests/unit/src/unit/issues/Issue10291.hx

@@ -0,0 +1,25 @@
+package unit.issues;
+
+import haxe.ds.Option;
+
+class Issue10291 extends Test {
+	function test() {
+		eq("Case 2: b=null", match());
+	}
+
+	function match() {
+		var ret = "";
+		var o = Some({b: null});
+		switch (o) {
+			case Some({b: b}) if (b != null):
+				ret = "Case 1: b=" + b;
+			case Some({b: null}):
+				ret = "Case 2: b=null";
+			case Some(_):
+				ret = "Case 3: Some(_)";
+			case None:
+				ret = ("Default");
+		}
+		return ret;
+	}
+}