summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-04-08 20:18:33 +0200
committerAraq <rumpf_a@web.de>2013-04-08 20:18:33 +0200
commit908383e4cab979dcc3ee7a1c1710dd5314984065 (patch)
tree807af8548365ee70ac6d2221ec5ebb5a01571b43
parentdc65ccde011023beab4e3405cb54d6229ed7082e (diff)
downloadNim-908383e4cab979dcc3ee7a1c1710dd5314984065.tar.gz
fixes #321
-rw-r--r--compiler/semexprs.nim3
-rw-r--r--tests/run/titerslice.nim9
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 962272ec4..bf07f843e 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -996,7 +996,8 @@ proc semSubscript(c: PContext, n: PNode, flags: TExprFlags): PNode =
     checkSonsLen(n, 2)
     n.sons[0] = makeDeref(n.sons[0])
     for i in countup(1, sonsLen(n) - 1): 
-      n.sons[i] = semExprWithType(c, n.sons[i], flags)
+      n.sons[i] = semExprWithType(c, n.sons[i], 
+                                  flags*{efInTypeof, efDetermineType})
     var indexType = if arr.kind == tyArray: arr.sons[0] else: getSysType(tyInt)
     var arg = IndexTypesMatch(c, indexType, n.sons[1].typ, n.sons[1])
     if arg != nil:
diff --git a/tests/run/titerslice.nim b/tests/run/titerslice.nim
new file mode 100644
index 000000000..e5d2e14a3
--- /dev/null
+++ b/tests/run/titerslice.nim
@@ -0,0 +1,9 @@
+discard """
+  output: '''2
+3
+4'''
+"""
+
+var t1 = @["1", "2", "3", "4"]
+for t in t1[1..3]:
+  echo t