Skip to content

internal error: environment misses: s with iterator/nimvm/variable shadowing #25725

@tersec

Description

@tersec

Nim Version

Nim Compiler Version 2.2.8 [Linux: amd64]
Compiled at 2026-04-09
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: 4f500679b196fad944caa50a753f5bbfaefda001
active boot switches: -d:release
Nim Compiler Version 2.2.9 [Linux: amd64]
Compiled at 2026-04-09
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: c7339047164d8c1feeef6822ba3c8ab4085db522
active boot switches: -d:release
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2026-04-09
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: 188aa1714e0bd95caca408265d49c720ae739449
active boot switches: -d:release

Description

iterator c(): int =
  when nimvm: yield 0
  else: yield 1
for w in c():
  let n = w
  proc p(s: int) =
    let s = s; discard n
  p(0)

Current Output

......................................................................
/tmp/k.nim(7, 9) Hint: 's' is declared but not used [XDeclaredButNotUsed]
/tmp/k.nim(7, 13) Error: internal error: environment misses: s

Expected Output

No Nim compiler internal error

Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions