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

Fix use global paths in macro bodies #14965

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Sep 4, 2024

Fixes the issue reported in #14860, but for all paths (not just Crystal) and only in locations where namespaces could clash.
That affects macro bodies which can be expanded in uncontrolled scopes.

This is a fixup for #14282 (released in 1.12.0).

Resolves #14860

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib kind:regression Something that used to correctly work but no longer works labels Sep 4, 2024
@straight-shoota straight-shoota self-assigned this Sep 4, 2024
@straight-shoota straight-shoota modified the milestone: 1.14.0 Sep 4, 2024
@straight-shoota straight-shoota added this to the 1.14.0 milestone Sep 4, 2024
@straight-shoota straight-shoota merged commit a310dee into crystal-lang:master Sep 6, 2024
63 of 65 checks passed
@straight-shoota straight-shoota deleted the fix/macro-path-resolution branch September 6, 2024 06:19
@straight-shoota straight-shoota modified the milestones: 1.14.0, 1.13.3 Sep 10, 2024
straight-shoota added a commit that referenced this pull request Sep 17, 2024
Macros inject code into other scopes. Paths are resolved in the expanded scope and there can be namespace conflicts.
This fixes non-global paths in macro bodies that expand into uncontrolled scopes where namespaces could clash.

This is a fixup for #14282 (released in 1.12.0).
@crysbot
Copy link

crysbot commented Sep 19, 2024

This pull request has been mentioned on Crystal Forum. There might be relevant details there:

https://forum.crystal-lang.org/t/crystal-1-13-3-is-released/7191/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:regression Something that used to correctly work but no longer works topic:stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants