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

fixes #24641; quote do captures no variables without backticks #24642

Draft
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Jan 23, 2025

fixes #24641

ref #17426

TODO:

This PR solves problems in nim-lang/RFCs#122

import macros

macro genPrintX(): untyped =
  let x = "mystring"
  result = quote do:
    echo x # Error: internal error: environment misses: x

proc main(): void =
  let x = 123
  genPrintX()

main()

The quoted ast won't capture local variables from macros anymore. It solves #7323 which is a special case of capturing result. Then we can revert #7343 that did some hack on result.

@ringabout ringabout changed the title fixes #24641; quote do captures no variables under current macros fixes #24641; quote do captures no variables without backticks under current macros Jan 23, 2025
@ringabout
Copy link
Member Author

ringabout commented Jan 23, 2025

related to #8574

@ringabout ringabout changed the title fixes #24641; quote do captures no variables without backticks under current macros fixes #24641; quote do captures no variables without backticks Jan 23, 2025
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 this pull request may close these issues.

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