bugfix: bug #511622
This commit is contained in:
parent
dab64b5c0e
commit
684bb09773
3 changed files with 8 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nimrod Compiler
|
# The Nimrod Compiler
|
||||||
# (c) Copyright 2009 Andreas Rumpf
|
# (c) Copyright 2010 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -287,7 +287,10 @@ proc transformConv(c: PTransf, n: PNode): PNode =
|
||||||
var source = skipTypes(n.sons[1].typ, abstractVarRange)
|
var source = skipTypes(n.sons[1].typ, abstractVarRange)
|
||||||
case dest.kind
|
case dest.kind
|
||||||
of tyInt..tyInt64, tyEnum, tyChar, tyBool:
|
of tyInt..tyInt64, tyEnum, tyChar, tyBool:
|
||||||
if (firstOrd(dest) <= firstOrd(source)) and
|
if not isOrdinalType(source):
|
||||||
|
# XXX int64 -> float conversion?
|
||||||
|
result = n
|
||||||
|
elif (firstOrd(dest) <= firstOrd(source)) and
|
||||||
(lastOrd(source) <= lastOrd(dest)):
|
(lastOrd(source) <= lastOrd(dest)):
|
||||||
# BUGFIX: simply leave n as it is; we need a nkConv node,
|
# BUGFIX: simply leave n as it is; we need a nkConv node,
|
||||||
# but no range check:
|
# but no range check:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ tbind3.nim;1
|
||||||
tbintre2.nim;halloworld99110223
|
tbintre2.nim;halloworld99110223
|
||||||
tbintree.nim;halloworld99110223
|
tbintree.nim;halloworld99110223
|
||||||
tbug499771.nim;TSubRange: 5 from 1 to 10
|
tbug499771.nim;TSubRange: 5 from 1 to 10
|
||||||
tbug511622.nim;10
|
tbug511622.nim;3
|
||||||
tcasestm.nim;ayyy
|
tcasestm.nim;ayyy
|
||||||
tclosure.nim;2 4 6 8 10
|
tclosure.nim;2 4 6 8 10
|
||||||
tcnstseq.nim;AngelikaAnneAnnaAnkaAnja
|
tcnstseq.nim;AngelikaAnneAnnaAnkaAnja
|
||||||
|
|
|
||||||
|
|
|
@ -6,4 +6,5 @@ proc FibonacciA(n: int): int64 =
|
||||||
var q: float64 = 1.0 / p
|
var q: float64 = 1.0 / p
|
||||||
return int64((pow(p, fn) + pow(q, fn)) / sqrt(5.0))
|
return int64((pow(p, fn) + pow(q, fn)) / sqrt(5.0))
|
||||||
|
|
||||||
echo FibonacciA(4) #OUT 10
|
echo FibonacciA(4) #OUT 3
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue