diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-01-08 01:47:54 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-01-08 01:47:54 +0100 |
commit | 2015895357cd1d32b4ae93a9b527b6d1171d8189 (patch) | |
tree | eff296fce4eb161ce8b49c0bcbc898af5defb867 /compiler/semexprs.nim | |
parent | e4081a720190dfdeb347442cdc2c01745476ff9c (diff) | |
download | Nim-2015895357cd1d32b4ae93a9b527b6d1171d8189.tar.gz |
sink type begins to compile
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r-- | compiler/semexprs.nim | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 577580f2e..795fa1910 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -181,9 +181,18 @@ proc semConv(c: PContext, n: PNode): PNode = result = newNodeI(nkConv, n.info) var targetType = semTypeNode(c, n.sons[0], nil).skipTypes({tyTypeDesc}) maybeLiftType(targetType, c, n[0].info) + + if targetType.kind in {tySink, tyLent}: + let baseType = semTypeNode(c, n.sons[1], nil).skipTypes({tyTypeDesc}) + let t = newTypeS(targetType.kind, c) + t.rawAddSonNoPropagationOfTypeFlags baseType + result = newNodeI(nkType, n.info) + result.typ = makeTypeDesc(c, t) + return + result.addSon copyTree(n.sons[0]) - var op = semExprWithType(c, n.sons[1]) + var op = semExprWithType(c, n.sons[1]) if targetType.isMetaType: let final = inferWithMetatype(c, targetType, op, true) result.addSon final @@ -191,6 +200,8 @@ proc semConv(c: PContext, n: PNode): PNode = return result.typ = targetType + # XXX op is overwritten later on, this is likely added too early + # here or needs to be overwritten too then. addSon(result, op) if not isSymChoice(op): |