fixes #1442
This commit is contained in:
parent
abc8447331
commit
32a5d4baf0
2 changed files with 16 additions and 4 deletions
|
|
@ -582,7 +582,10 @@ proc firstOrd(t: PType): BiggestInt =
|
||||||
of tyGenericInst, tyDistinct, tyConst, tyMutable,
|
of tyGenericInst, tyDistinct, tyConst, tyMutable,
|
||||||
tyTypeDesc, tyFieldAccessor:
|
tyTypeDesc, tyFieldAccessor:
|
||||||
result = firstOrd(lastSon(t))
|
result = firstOrd(lastSon(t))
|
||||||
else:
|
of tyOrdinal:
|
||||||
|
if t.len > 0: result = firstOrd(lastSon(t))
|
||||||
|
else: internalError("invalid kind for first(" & $t.kind & ')')
|
||||||
|
else:
|
||||||
internalError("invalid kind for first(" & $t.kind & ')')
|
internalError("invalid kind for first(" & $t.kind & ')')
|
||||||
result = 0
|
result = 0
|
||||||
|
|
||||||
|
|
@ -617,7 +620,10 @@ proc lastOrd(t: PType): BiggestInt =
|
||||||
tyTypeDesc, tyFieldAccessor:
|
tyTypeDesc, tyFieldAccessor:
|
||||||
result = lastOrd(lastSon(t))
|
result = lastOrd(lastSon(t))
|
||||||
of tyProxy: result = 0
|
of tyProxy: result = 0
|
||||||
else:
|
of tyOrdinal:
|
||||||
|
if t.len > 0: result = lastOrd(lastSon(t))
|
||||||
|
else: internalError("invalid kind for last(" & $t.kind & ')')
|
||||||
|
else:
|
||||||
internalError("invalid kind for last(" & $t.kind & ')')
|
internalError("invalid kind for last(" & $t.kind & ')')
|
||||||
result = 0
|
result = 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tstrange.nim"
|
file: "tstrange.nim"
|
||||||
output: "hallo4"
|
output: '''hallo4
|
||||||
|
0
|
||||||
|
1
|
||||||
|
2'''
|
||||||
"""
|
"""
|
||||||
# test for extremely strange bug
|
# test for extremely strange bug
|
||||||
|
|
||||||
|
|
@ -19,5 +22,8 @@ gen("hallo")
|
||||||
write(stdout, ack(5, 4))
|
write(stdout, ack(5, 4))
|
||||||
#OUT hallo4
|
#OUT hallo4
|
||||||
|
|
||||||
|
# bug #1442
|
||||||
|
let h=3
|
||||||
|
for x in 0.. <h.int:
|
||||||
|
echo x
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue