diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 9eccdef456..1e5772189c 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -408,8 +408,7 @@ proc isOpImpl(c: PContext, n: PNode, flags: TExprFlags): PNode = of "closure": let t = skipTypes(t1, abstractRange) res = t.kind == tyProc and - t.callConv == ccClosure and - tfIterator notin t.flags + t.callConv == ccClosure of "iterator": let t = skipTypes(t1, abstractRange) res = t.kind == tyProc and diff --git a/tests/stdlib/thashes.nim b/tests/stdlib/thashes.nim index 9c92877848..b8a2c2c6a4 100644 --- a/tests/stdlib/thashes.nim +++ b/tests/stdlib/thashes.nim @@ -4,6 +4,15 @@ discard """ import std/hashes + +when not defined(js) and not defined(cpp): + block: + var x = 12 + iterator hello(): int {.closure.} = + yield x + + discard hash(hello) + block hashes: block hashing: var dummy = 0.0