diff options
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index a71a57175..230a9c0d4 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -471,10 +471,14 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = ($typ.kind).substr(2).toLowerAscii) elif typ.kind == tyProc and tfUnresolved in typ.flags: localError(c.config, def.info, errProcHasNoConcreteType % def.renderTree) - elif symkind == skVar and typ.kind == tyOwned and def.kind notin nkCallKinds: - # special type inference rule: 'var it = ownedPointer' is turned - # into an unowned pointer. - typ = typ.lastSon + when false: + # XXX This typing rule is neither documented nor complete enough to + # justify it. Instead use the newer 'unowned x' until we figured out + # a more general solution. + if symkind == skVar and typ.kind == tyOwned and def.kind notin nkCallKinds: + # special type inference rule: 'var it = ownedPointer' is turned + # into an unowned pointer. + typ = typ.lastSon else: if symkind == skLet: localError(c.config, a.info, errLetNeedsInit) |