summary refs log tree commit diff stats
path: root/tests/generics/mopensymimport1.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/generics/mopensymimport1.nim')
-rw-r--r--tests/generics/mopensymimport1.nim34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/generics/mopensymimport1.nim b/tests/generics/mopensymimport1.nim
new file mode 100644
index 000000000..912db1302
--- /dev/null
+++ b/tests/generics/mopensymimport1.nim
@@ -0,0 +1,34 @@
+type
+  Result*[T, E] = object
+    when T is void:
+      when E is void:
+        oResultPrivate*: bool
+      else:
+        case oResultPrivate*: bool
+        of false:
+          eResultPrivate*: E
+        of true:
+          discard
+    else:
+      when E is void:
+        case oResultPrivate*: bool
+        of false:
+          discard
+        of true:
+          vResultPrivate*: T
+      else:
+        case oResultPrivate*: bool
+        of false:
+          eResultPrivate*: E
+        of true:
+          vResultPrivate*: T
+
+template valueOr*[T: not void, E](self: Result[T, E], def: untyped): untyped =
+  let s = (self) # TODO avoid copy
+  case s.oResultPrivate
+  of true:
+    s.vResultPrivate
+  of false:
+    when E isnot void:
+      template error: untyped {.used, inject.} = s.eResultPrivate
+    def
ik.com> 2015-05-16 13:17:36 -0700 1383 - warn on unknown type' href='/akkartik/mu/commit/047jump_label.cc?h=main&id=b142a7620246d57b461e5863b9d1092a917a2fc3'>b142a762 ^
dc1323e9 ^



363be37f ^
ac0e9db5 ^

dc1323e9 ^


ac0e9db5 ^
dc1323e9 ^
363be37f ^
4071055a ^
dc1323e9 ^
363be37f ^
4071055a ^
dc1323e9 ^
363be37f ^
ac0e9db5 ^
4071055a ^
dc1323e9 ^
363be37f ^

ac0e9db5 ^
4071055a ^
dc1323e9 ^




363be37f ^
e4630643 ^



dc1323e9 ^
0f125d5f ^
dc1323e9 ^
e4630643 ^
827898fc ^
dc1323e9 ^






8ba8f0f6 ^
bc643692 ^
dc1323e9 ^









bc643692 ^

dc1323e9 ^









bc643692 ^

dc1323e9 ^




4071055a ^



bc643692 ^


8ba8f0f6 ^
bc643692 ^
4071055a ^
bc643692 ^
4071055a ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110