This commit is contained in:
Araq 2015-03-05 22:03:26 +01:00
commit 4d8cd34c9e
3 changed files with 33 additions and 18 deletions

View file

@ -823,8 +823,13 @@ proc sameEnumTypes*(a, b: PType): bool {.inline.} =
proc sameObjectTree(a, b: PNode, c: var TSameTypeClosure): bool =
if a == b:
result = true
elif (a != nil) and (b != nil) and (a.kind == b.kind):
if sameTypeOrNilAux(a.typ, b.typ, c):
elif a != nil and b != nil and a.kind == b.kind:
var x = a.typ
var y = b.typ
if IgnoreTupleFields in c.flags:
if x != nil: x = skipTypes(x, {tyRange, tyGenericInst})
if y != nil: y = skipTypes(y, {tyRange, tyGenericInst})
if sameTypeOrNilAux(x, y, c):
case a.kind
of nkSym:
# same symbol as string is enough:

View file

@ -0,0 +1,10 @@
# bug #794
type TRange = range[0..3]
const str = "123456789"
for i in TRange.low .. TRange.high:
echo str[i] #This works fine
echo str[int(i) .. int(TRange.high)] #So does this
echo str[i .. TRange.high] #The compiler complains about this