parent
87568830ab
commit
c50a04adc5
3 changed files with 82 additions and 12 deletions
|
|
@ -1835,7 +1835,7 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
|
|||
if destIsGeneric:
|
||||
dest = generateTypeInstance(c, m.bindings, arg, dest)
|
||||
let fdest = typeRel(m, f, dest)
|
||||
if fdest in {isEqual, isGeneric}:
|
||||
if fdest in {isEqual, isGeneric} and not (dest.kind == tyLent and f.kind == tyVar):
|
||||
markUsed(c.config, arg.info, c.converters[i], c.graph.usageSym)
|
||||
var s = newSymNode(c.converters[i])
|
||||
s.typ = c.converters[i].typ
|
||||
|
|
@ -2231,8 +2231,15 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
|
|||
else:
|
||||
m.state = csNoMatch
|
||||
return
|
||||
|
||||
if formal.typ.kind == tyVar:
|
||||
if not n.isLValue:
|
||||
let arg_converter = if arg.kind == nkHiddenDeref: arg[0] else: arg
|
||||
if arg_converter.kind == nkHiddenCallConv:
|
||||
if arg_converter.typ.kind != tyVar:
|
||||
m.state = csNoMatch
|
||||
m.mutabilityProblem = uint8(f-1)
|
||||
return
|
||||
elif not n.isLValue:
|
||||
m.state = csNoMatch
|
||||
m.mutabilityProblem = uint8(f-1)
|
||||
return
|
||||
|
|
@ -2243,6 +2250,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
|
|||
else: 0
|
||||
# iterates over the actual given arguments
|
||||
a = 1
|
||||
arg: PNode # current prepared argument
|
||||
|
||||
m.state = csMatch # until proven otherwise
|
||||
m.call = newNodeI(n.kind, n.info)
|
||||
|
|
@ -2297,7 +2305,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
|
|||
m.typedescMatched = false
|
||||
n.sons[a].sons[1] = prepareOperand(c, formal.typ, n.sons[a].sons[1])
|
||||
n.sons[a].typ = n.sons[a].sons[1].typ
|
||||
var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ,
|
||||
arg = paramTypesMatch(m, formal.typ, n.sons[a].typ,
|
||||
n.sons[a].sons[1], n.sons[a].sons[1])
|
||||
if arg == nil:
|
||||
m.state = csNoMatch
|
||||
|
|
@ -2334,7 +2342,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
|
|||
m.typedescMatched = false
|
||||
incl(marker, formal.position)
|
||||
n.sons[a] = prepareOperand(c, formal.typ, n.sons[a])
|
||||
var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ,
|
||||
arg = paramTypesMatch(m, formal.typ, n.sons[a].typ,
|
||||
n.sons[a], nOrig.sons[a])
|
||||
if arg != nil and m.baseTypeMatch and container != nil:
|
||||
addSon(container, arg)
|
||||
|
|
@ -2368,7 +2376,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
|
|||
m.baseTypeMatch = false
|
||||
m.typedescMatched = false
|
||||
n.sons[a] = prepareOperand(c, formal.typ, n.sons[a])
|
||||
var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ,
|
||||
arg = paramTypesMatch(m, formal.typ, n.sons[a].typ,
|
||||
n.sons[a], nOrig.sons[a])
|
||||
if arg == nil:
|
||||
m.state = csNoMatch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue