bugfix: type converter that converts to bool in 'if' context
This commit is contained in:
parent
220dd54acf
commit
032599c156
11 changed files with 77 additions and 25 deletions
|
|
@ -461,6 +461,7 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
|
|||
var dest = c.converters[i].typ.sons[0]
|
||||
if (typeRel(m.bindings, f, dest) == isEqual) and
|
||||
(typeRel(m.bindings, src, a) == isEqual):
|
||||
markUsed(arg, c.converters[i])
|
||||
var s = newSymNode(c.converters[i])
|
||||
s.typ = c.converters[i].typ
|
||||
s.info = arg.info
|
||||
|
|
@ -564,6 +565,11 @@ proc IndexTypesMatch*(c: PContext, f, a: PType, arg: PNode): PNode =
|
|||
initCandidate(m, f)
|
||||
result = paramTypesMatch(c, m, f, a, arg)
|
||||
|
||||
proc ConvertTo*(c: PContext, f: PType, n: PNode): PNode =
|
||||
var m: TCandidate
|
||||
initCandidate(m, f)
|
||||
result = paramTypesMatch(c, m, f, n.typ, n)
|
||||
|
||||
proc argtypeMatches*(c: PContext, f, a: PType): bool =
|
||||
var m: TCandidate
|
||||
initCandidate(m, f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue