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 for allowing :throw_undef_if_not on the frontend #53944

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

Pangoraw
Copy link
Contributor

@Pangoraw Pangoraw commented Apr 3, 2024

#53875 allowed :throw_undef_if_not as a frontend form.

However, the UndefVarError being tested is thrown because the first argument is resolved to a global ref:

julia> @eval function has_tuin()
           $(Expr(:throw_undef_if_not, :x, false))
       end
has_tuin (generic function with 1 method)

julia> @code_lowered has_tuin() # master
CodeInfo(
1%1 = $(Expr(:throw_undef_if_not, :(Main.x), false))
└──      return %1
)

julia> @code_lowered has_tuin() # this pr
CodeInfo(
1%1 = $(Expr(:throw_undef_if_not, :x, false))
└──      return %1
)

This change skips this global ref resolution for the first argument and fixes a typo which would throw an error in case of non-const second argument.

Copy link
Member

@Keno Keno left a comment

Choose a reason for hiding this comment

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

Good catch, thanks

@aviatesk aviatesk merged commit 19fffe1 into JuliaLang:master Apr 4, 2024
7 checks passed
@Pangoraw Pangoraw deleted the pb/tuin branch April 8, 2024 08:50
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.

None yet

3 participants