shithub: mc

Download patch

ref: 076f4d371d887d25c3ac3851589f161131f57c88
parent: cebd9262172a94782ffadd1ebc2bf66dfee971e1
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Oct 23 11:41:01 EDT 2019

Add missing file.

--- /dev/null
+++ b/test/matchctup.myr
@@ -1,0 +1,32 @@
+use std
+
+const main = {
+        match (gen_a(), gen_b())
+        | (`std.Err _, _): std.put("error case 1")
+        | (_, `std.Err _): std.put("error case 2")
+        | (`std.Ok L, `std.Ok N):
+                std.put("l = {} n = {}\n", L, N)
+        ;;
+}
+
+var gen_a : (-> std.result(byte[:][:], void)) = {
+        var ret = [][:]
+
+        for var j = 0; j < 4; ++j
+                std.slpush(&ret, std.fmt("{}", j))
+        ;;
+
+        if 1 + 1 > 3
+                -> `std.Err void
+        ;;
+
+        -> `std.Ok ret
+}
+
+var gen_b : (-> std.result(int, void)) = {
+        if 1 + 1 > 3
+                -> `std.Err void
+        ;;
+
+        -> `std.Ok 5
+}