This commit is contained in:
Araq
2013-04-08 20:18:33 +02:00
parent dc65ccde01
commit 908383e4ca
2 changed files with 11 additions and 1 deletions

View File

@@ -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:

9
tests/run/titerslice.nim Normal file
View File

@@ -0,0 +1,9 @@
discard """
output: '''2
3
4'''
"""
var t1 = @["1", "2", "3", "4"]
for t in t1[1..3]:
echo t