fixes #794
This commit is contained in:
parent
1a9f266e50
commit
4d8cd34c9e
3 changed files with 33 additions and 18 deletions
|
|
@ -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:
|
||||
|
|
|
|||
10
tests/ccgbugs/tstringslice.nim
Normal file
10
tests/ccgbugs/tstringslice.nim
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue