mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
fixes #321
This commit is contained in:
@@ -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
9
tests/run/titerslice.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
discard """
|
||||
output: '''2
|
||||
3
|
||||
4'''
|
||||
"""
|
||||
|
||||
var t1 = @["1", "2", "3", "4"]
|
||||
for t in t1[1..3]:
|
||||
echo t
|
||||
Reference in New Issue
Block a user