Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: internal error: expr: var not init a_536870917 with non-quasiquoted variable in macro #24641

Open
tersec opened this issue Jan 23, 2025 · 0 comments · May be fixed by #24642
Open

Error: internal error: expr: var not init a_536870917 with non-quasiquoted variable in macro #24641

tersec opened this issue Jan 23, 2025 · 0 comments · May be fixed by #24642
Assignees

Comments

@tersec
Copy link
Contributor

tersec commented Jan 23, 2025

Description

import std/macros

macro p(): untyped =
  result = newStmtList()
  var a: int
  result.add quote do:
    discard a

p()

It's true that using, e.g.,

  discard `a`

fixes this, and this isn't meant to be correct-as-such-code. The point here is the Nim compiler internal error.

Nim Version

Nim Compiler Version 2.0.14 [Linux: amd64]
Compiled at 2025-01-23
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: bf4de6a394e040d9810cba8c69fb2829ff04dcc6
active boot switches: -d:release
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-01-23
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 6d59680217cfbd9314cf62d1d07adc8e6e552d53
active boot switches: -d:release

Current Output

Error: internal error: expr: var not init a_536870917
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details

Expected Output

No Nim internal error

Known Workarounds

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants