Nim Version
Nim Compiler Version 2.2.8 [MacOSX: arm64]
Compiled at 2026-03-24
Copyright (c) 2006-2026 by Andreas Rumpf
git hash: 4f50067
active boot switches: -d:release
Description
lib.nim
import std/sets
func impl*(flag: static bool): seq[uint64] =
var all = initHashSet[uint64]()
all.incl 1
for idx in all: # fails cross-module
# for idx in all.items(): # workaround
result.add idx
template bar*(): seq[uint64] =
impl(flag = true)
repro.nim
Current Output
//./repro.nim(2, 9) template/generic instantiation of `bar` from here
//./lib.nim(6, 14) Error: type mismatch
Expression: items(all)
[1] all: HashSet[system.uint64]
Expected Output
Known Workarounds
Explicit .items() in the loop
Additional Information
No response
Nim Version
Nim Compiler Version 2.2.8 [MacOSX: arm64]
Compiled at 2026-03-24
Copyright (c) 2006-2026 by Andreas Rumpf
git hash: 4f50067
active boot switches: -d:release
Description
lib.nim
repro.nim
Current Output
Expected Output
Known Workarounds
Explicit
.items()in the loopAdditional Information
No response