diff options
Diffstat (limited to 'tests/accept/compile')
-rw-r--r-- | tests/accept/compile/tgenericmatcher2.nim | 18 | ||||
-rw-r--r-- | tests/accept/compile/titer_no_tuple_unpack.nim | 13 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/accept/compile/tgenericmatcher2.nim b/tests/accept/compile/tgenericmatcher2.nim new file mode 100644 index 000000000..aa2f9dbb3 --- /dev/null +++ b/tests/accept/compile/tgenericmatcher2.nim @@ -0,0 +1,18 @@ + +type + TMatcherKind = enum + mkTerminal, mkSequence, mkAlternation, mkRepeat + TMatcher[T] = object + case kind: TMatcherKind + of mkTerminal: + value: T + of mkSequence, mkAlternation: + matchers: seq[TMatcher[T]] + of mkRepeat: + matcher: ref TMatcher[T] + min, max: int + +var + m: ref TMatcher[int] + + diff --git a/tests/accept/compile/titer_no_tuple_unpack.nim b/tests/accept/compile/titer_no_tuple_unpack.nim new file mode 100644 index 000000000..da5e1bc46 --- /dev/null +++ b/tests/accept/compile/titer_no_tuple_unpack.nim @@ -0,0 +1,13 @@ + +iterator xrange(fromm, to: int, step = 1): tuple[x, y: int] = + var a = fromm + while a <= to: + yield (a, a+1) + inc(a, step) + +for a, b in xrange(3, 7): + echo a, " ", b + +for tup in xrange(3, 7): + echo tup + |