Skip to content

Conversation

KristofferC
Copy link
Member

Fixes #54417

@KristofferC KristofferC added the macros @macros label May 29, 2024
return Expr(:block,
Expr(:inbounds, true),
Expr(:local, Expr(:(=), :val, esc(blk))),
Expr(:local, Expr(:(=), :val_49f6338b, esc(blk))),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gensym? But as was pointed out in the original issue, the macro is fine as written, the current behavior is a bug. Maybe leave a comment that effect?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gensym is not defined during bootstrapping so this seemed easiest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is off-topic, but I wonder if reserved words might be useful in these cases. cf. (PR #51215)
Of course, we still need to be careful to avoid collisions in Base and stdlibs.

end
end

@testset "inbounds hygien confusion" begin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@testset "inbounds hygien confusion" begin
@testset "inbounds hygiene confusion" begin

@giordano giordano changed the title rename variable used in inbounds to avoid accidental collisions due to macry hygiene bug rename variable used in inbounds to avoid accidental collisions due to macro hygiene bug May 29, 2024
@KristofferC
Copy link
Member Author

KristofferC commented Jul 11, 2025

#58965

@giordano giordano deleted the kc/macro_mixups branch July 11, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macros @macros
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@inbounds overrides val variable in macros. Wrong usage of local
5 participants