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

InteractiveUtils: escape macro keywords #41040

Merged
merged 1 commit into from
Jun 1, 2021
Merged

InteractiveUtils: escape macro keywords #41040

merged 1 commit into from
Jun 1, 2021

Conversation

aviatesk
Copy link
Member

@aviatesk aviatesk commented Jun 1, 2021

Previously @code_typed and its family can't accept variables as
keyword options since they're not escaped:

julia> let
           opt = false
           @code_typed optimize=opt sum(1:10)
       end
ERROR: UndefVarError: opt not defined
Stacktrace:
 [1] macro expansion
   @ ~/julia/julia/usr/share/julia/stdlib/v1.7/InteractiveUtils/src/macros.jl:222 [inlined]
 [2] top-level scope
   @ REPL[2]:3

Previously `@code_typed` and its family can't accept variables as
keyword options since they're not escaped:
```julia
julia> let
           opt = false
           @code_typed optimize=opt sum(1:10)
       end
ERROR: UndefVarError: opt not defined
Stacktrace:
 [1] macro expansion
   @ ~/julia/julia/usr/share/julia/stdlib/v1.7/InteractiveUtils/src/macros.jl:222 [inlined]
 [2] top-level scope
   @ REPL[1]:3
```
aviatesk added a commit to aviatesk/JET.jl that referenced this pull request Jun 1, 2021
Copy link
Member

@simeonschaub simeonschaub left a comment

Choose a reason for hiding this comment

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

LGTM

@aviatesk
Copy link
Member Author

aviatesk commented Jun 1, 2021

Will merge once CI gets passed.

@aviatesk aviatesk merged commit d1c2e09 into master Jun 1, 2021
@aviatesk aviatesk deleted the avi/escapeopts branch June 1, 2021 12:45
shirodkara pushed a commit to shirodkara/julia that referenced this pull request Jun 9, 2021
Previously `@code_typed` and its family can't accept variables as
keyword options since they're not escaped:
```julia
julia> let
           opt = false
           @code_typed optimize=opt sum(1:10)
       end
ERROR: UndefVarError: opt not defined
Stacktrace:
 [1] macro expansion
   @ ~/julia/julia/usr/share/julia/stdlib/v1.7/InteractiveUtils/src/macros.jl:222 [inlined]
 [2] top-level scope
   @ REPL[1]:3
```
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
Previously `@code_typed` and its family can't accept variables as
keyword options since they're not escaped:
```julia
julia> let
           opt = false
           @code_typed optimize=opt sum(1:10)
       end
ERROR: UndefVarError: opt not defined
Stacktrace:
 [1] macro expansion
   @ ~/julia/julia/usr/share/julia/stdlib/v1.7/InteractiveUtils/src/macros.jl:222 [inlined]
 [2] top-level scope
   @ REPL[1]:3
```
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.

2 participants