Continue bool conversion fixing (#13751)
* continue fixing #13744 * improve style * improve test Co-authored-by: cooldome <ariabushenko@bk.ru>
This commit is contained in:
parent
e1e062197e
commit
764a81ca25
3 changed files with 20 additions and 2 deletions
|
|
@ -147,7 +147,9 @@ proc checkConvertible(c: PContext, targetTyp: PType, src: PNode): TConvStatus =
|
|||
result = checkConversionBetweenObjects(d.skipTypes(abstractInst), s.skipTypes(abstractInst), pointers)
|
||||
elif (targetBaseTyp.kind in IntegralTypes) and
|
||||
(srcBaseTyp.kind in IntegralTypes):
|
||||
if targetTyp.isOrdinalType:
|
||||
if targetTyp.kind == tyBool:
|
||||
discard "convOk"
|
||||
elif targetTyp.isOrdinalType:
|
||||
if src.kind in nkCharLit..nkUInt64Lit and
|
||||
src.getInt notin firstOrd(c.config, targetTyp)..lastOrd(c.config, targetTyp):
|
||||
result = convNotInRange
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue