Closed
Description
julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
CPU: Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = vscode
julia> @code_lowered sin.(3)
CodeInfo(
1 ─ %1 = Base.broadcasted(Main.sin, x1)
│ %2 = Base.materialize(%1)
└── return %2
)
julia> @code_lowered 1 .+ 1
ERROR: UndefVarError: .+ not defined
Stacktrace:
[1] top-level scope
@ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/InteractiveUtils/src/macros.jl:230
It also happens on Julia v1.6
By the way,
julia> @macroexpand (@code_lowered 1 .+ 1)
quote
#= /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/InteractiveUtils/src/macros.jl:230 =#
local var"#30#results" = InteractiveUtils.code_lowered(.+, (Base.typesof)(1, 1))
#= /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/InteractiveUtils/src/macros.jl:231 =#
if InteractiveUtils.length(var"#30#results") == 1
var"#30#results"[1]
else
var"#30#results"
end
end
I don't understand how the error arises. InteractiveUtils.code_lowered(.+, (Base.typesof)(1, 1))
evaluates correctly in the scope of the macro invocation.
Metadata
Metadata
Assignees
Labels
No labels