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

@code_typed optimize=true not_a_call fails to throw a meaningful error #34179

Closed
tkf opened this issue Dec 22, 2019 · 2 comments
Closed

@code_typed optimize=true not_a_call fails to throw a meaningful error #34179

tkf opened this issue Dec 22, 2019 · 2 comments

Comments

@tkf
Copy link
Member

tkf commented Dec 22, 2019

julia> @code_typed optimize=true not_a_call
ERROR: function error does not accept keyword arguments
Stacktrace:
 [1] kwfunc(::Any) at ./boot.jl:332
 [2] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/InteractiveUtils/src/macros.jl:143

julia> @macroexpand @code_typed optimize=true no_a_call
quote
    #= /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/InteractiveUtils/src/macros.jl:143 =#
    var"#139#results" = InteractiveUtils.error("expression is not a function call or symbol", optimize=true)
    #= /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/InteractiveUtils/src/macros.jl:144 =#
    if InteractiveUtils.length(var"#139#results") == 1
        var"#139#results"[1]
    else
        var"#139#results"
    end
end

Note the keyword argument optimize=true in InteractiveUtils.error("...", optimize=true).

This happens with 1.3 and 1.4.0-DEV.634.

@Liozou
Copy link
Member

Liozou commented Jun 13, 2020

Incidentally fixed by #35522 I believe? It now appears like

julia> @code_typed optimize=true not_a_call
ERROR: expression is not a function call or symbol
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /home/liozou/julia/usr/share/julia/stdlib/v1.6/InteractiveUtils/src/macros.jl:220

@tkf
Copy link
Member Author

tkf commented Jun 13, 2020

Yes, it works now. Thanks!

@tkf tkf closed this as completed Jun 13, 2020
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

No branches or pull requests

2 participants