summary refs log tree commit diff stats
path: root/tests/accept/run/tvarres2.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-07-28 00:53:52 +0200
committerAraq <rumpf_a@web.de>2011-07-28 00:53:52 +0200
commit2f066395baf0dd290bfdbb8ee47a64a17c932b14 (patch)
tree3cab7059beb39e763e64521b2c0f84983e64deb9 /tests/accept/run/tvarres2.nim
parente7135c449d065eaf3ea6d2ed06fd33cb62e5e44f (diff)
downloadNim-2f066395baf0dd290bfdbb8ee47a64a17c932b14.tar.gz
bugfixes; step one for 'var T' as return type support
Diffstat (limited to 'tests/accept/run/tvarres2.nim')
-rw-r--r--tests/accept/run/tvarres2.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/accept/run/tvarres2.nim b/tests/accept/run/tvarres2.nim
new file mode 100644
index 000000000..119560e7b
--- /dev/null
+++ b/tests/accept/run/tvarres2.nim
@@ -0,0 +1,20 @@
+discard """
+  output: "45 hallo"
+"""
+
+type
+  TKachel = tuple[i: int, s: string]
+  TSpielwiese = object
+    k: seq[TKachel]
+
+var
+  spielwiese: TSpielwiese
+newSeq(spielwiese.k, 64)
+
+proc at*(s: var TSpielwiese, x, y: int): var TKachel =
+  result = s.k[y * 8 + x]
+
+spielwiese.at(3, 4) = (45, "hallo")
+
+echo spielwiese.at(3,4)[0], " ", spielwiese.at(3,4)[1]
+