refactor illegal iterator assignment detection (#12212)
* refactor illegal iterator assignment detection * delete crappy test
This commit is contained in:
parent
245a954b25
commit
7cf3395d85
9 changed files with 54 additions and 54 deletions
|
|
@ -1724,7 +1724,7 @@ proc semReturn(c: PContext, n: PNode): PNode =
|
|||
result = n
|
||||
checkSonsLen(n, 1, c.config)
|
||||
if c.p.owner.kind in {skConverter, skMethod, skProc, skFunc, skMacro} or
|
||||
isClosureIterator(c.p.owner):
|
||||
isClosureIterator(c.p.owner.typ):
|
||||
if n.sons[0].kind != nkEmpty:
|
||||
# transform ``return expr`` to ``result = expr; return``
|
||||
if c.p.resultSym != nil:
|
||||
|
|
@ -1771,7 +1771,7 @@ proc semProcBody(c: PContext, n: PNode): PNode =
|
|||
else:
|
||||
localError(c.config, c.p.resultSym.info, errCannotInferReturnType %
|
||||
c.p.owner.name.s)
|
||||
if isInlineIterator(c.p.owner) and c.p.owner.typ.sons[0] != nil and
|
||||
if isInlineIterator(c.p.owner.typ) and c.p.owner.typ.sons[0] != nil and
|
||||
c.p.owner.typ.sons[0].kind == tyUntyped:
|
||||
localError(c.config, c.p.owner.info, errCannotInferReturnType %
|
||||
c.p.owner.name.s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue