diff options
author | Araq <rumpf_a@web.de> | 2011-07-28 00:53:52 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-07-28 00:53:52 +0200 |
commit | 2f066395baf0dd290bfdbb8ee47a64a17c932b14 (patch) | |
tree | 3cab7059beb39e763e64521b2c0f84983e64deb9 /tests/accept/run/tvarres2.nim | |
parent | e7135c449d065eaf3ea6d2ed06fd33cb62e5e44f (diff) | |
download | Nim-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.nim | 20 |
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] + |