some progress on #3832

This commit is contained in:
Andreas Rumpf
2016-02-08 01:43:38 +01:00
parent e67124ca80
commit ee6a46f264
2 changed files with 10 additions and 1 deletions

View File

@@ -182,6 +182,9 @@ proc isAssignable*(owner: PSym, n: PNode; isUnsafeAddr=false): TAssignableResult
## 'owner' can be nil!
result = arNone
case n.kind
of nkEmpty:
if n.typ != nil and n.typ.kind == tyVar:
result = arLValue
of nkSym:
let kinds = if isUnsafeAddr: {skVar, skResult, skTemp, skParam, skLet}
else: {skVar, skResult, skTemp}

View File

@@ -420,7 +420,13 @@ proc searchForBorrowProc(c: PContext, startScope: PScope, fn: PSym): PSym =
let param = fn.typ.n.sons[i]
let t = skipTypes(param.typ, abstractVar-{tyTypeDesc})
if t.kind == tyDistinct or param.typ.kind == tyDistinct: hasDistinct = true
call.add(newNodeIT(nkEmpty, fn.info, t.baseOfDistinct))
var x: PType
if param.typ.kind == tyVar:
x = newTypeS(tyVar, c)
x.addSonSkipIntLit t.baseOfDistinct
else:
x = t.baseOfDistinct
call.add(newNodeIT(nkEmpty, fn.info, x))
if hasDistinct:
var resolved = semOverloadedCall(c, call, call, {fn.kind})
if resolved != nil: