summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index ab9ecd1a6..5d1770a32 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1309,6 +1309,7 @@ proc determineType(c: PContext, s: PSym) =
 
 proc semIterator(c: PContext, n: PNode): PNode =
   # gensym'ed iterator?
+  let isAnon = n[namePos].kind == nkEmpty
   if n[namePos].kind == nkSym:
     # gensym'ed iterators might need to become closure iterators:
     n[namePos].sym.owner = getCurrOwner()
@@ -1318,6 +1319,8 @@ proc semIterator(c: PContext, n: PNode): PNode =
   var t = s.typ
   if t.sons[0] == nil and s.typ.callConv != ccClosure:
     localError(n.info, errXNeedsReturnType, "iterator")
+  if isAnon and s.typ.callConv == ccInline:
+    localError(n.info, "inline iterators are not first-class / cannot be assigned to variables")
   # iterators are either 'inline' or 'closure'; for backwards compatibility,
   # we require first class iterators to be marked with 'closure' explicitly
   # -- at least for 0.9.2.