Skip to content

Commit

Permalink
fix is "closure" (nim-lang#16552)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored and ardek66 committed Mar 26, 2021
1 parent 81170ec commit 732fedc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/semexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions tests/stdlib/thashes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 732fedc

Please sign in to comment.