Fix #1424 some more
This commit is contained in:
parent
7c3a28ae8b
commit
7a09b3b57b
1 changed files with 5 additions and 1 deletions
|
|
@ -185,19 +185,23 @@ proc isCastable(dst, src: PType): bool =
|
||||||
# castableTypeKinds = {tyInt, tyPtr, tyRef, tyCstring, tyString,
|
# castableTypeKinds = {tyInt, tyPtr, tyRef, tyCstring, tyString,
|
||||||
# tySequence, tyPointer, tyNil, tyOpenArray,
|
# tySequence, tyPointer, tyNil, tyOpenArray,
|
||||||
# tyProc, tySet, tyEnum, tyBool, tyChar}
|
# tyProc, tySet, tyEnum, tyBool, tyChar}
|
||||||
if dst.kind == tyOpenArray:
|
if skipTypes(dst, abstractInst-{tyOpenArray}).kind == tyOpenArray:
|
||||||
return false
|
return false
|
||||||
var dstSize, srcSize: BiggestInt
|
var dstSize, srcSize: BiggestInt
|
||||||
|
|
||||||
dstSize = computeSize(dst)
|
dstSize = computeSize(dst)
|
||||||
srcSize = computeSize(src)
|
srcSize = computeSize(src)
|
||||||
if dstSize < 0:
|
if dstSize < 0:
|
||||||
|
echo 'a'
|
||||||
result = false
|
result = false
|
||||||
elif srcSize < 0:
|
elif srcSize < 0:
|
||||||
|
echo 'b'
|
||||||
result = false
|
result = false
|
||||||
elif not typeAllowed(dst, skParam):
|
elif not typeAllowed(dst, skParam):
|
||||||
|
echo 'c'
|
||||||
result = false
|
result = false
|
||||||
else:
|
else:
|
||||||
|
echo 'd'
|
||||||
result = (dstSize >= srcSize) or
|
result = (dstSize >= srcSize) or
|
||||||
(skipTypes(dst, abstractInst).kind in IntegralTypes) or
|
(skipTypes(dst, abstractInst).kind in IntegralTypes) or
|
||||||
(skipTypes(src, abstractInst-{tyTypeDesc}).kind in IntegralTypes)
|
(skipTypes(src, abstractInst-{tyTypeDesc}).kind in IntegralTypes)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue