Converter bug fixes (#9700)

* Fixes #9698
* Fixes #9699
This commit is contained in:
cooldome 2018-11-15 12:14:48 +00:00 • committed by Andreas Rumpf
commit c5c4da4f3c
4 changed files with 118 additions and 2 deletions

View file

@ -13,7 +13,7 @@
import
intsets, ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst,
magicsys, condsyms, idents, lexer, options, parampatterns, strutils, trees,
linter, lineinfos, modulegraphs
linter, lineinfos, lowerings, modulegraphs
when (defined(booting) or defined(nimsuggest)) and not defined(leanCompiler):
import docgen
@ -1855,8 +1855,14 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
else:
param = copyTree(arg)
addSon(result, param)
if dest.kind in {tyVar, tyLent}:
dest.flags.incl tfVarIsPtr
result = newDeref(result)
inc(m.convMatches)
m.genericConverter = srca == isGeneric or destIsGeneric
if m.genericConverter == false:
m.genericConverter = srca == isGeneric or destIsGeneric
return result
proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType,