-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
display and printingAesthetics and correctness of printed representations of objects.Aesthetics and correctness of printed representations of objects.
Description
Consider
julia> using Test
julia> Base.remove_linenums!(@macroexpand1 @test 1 == 2)
quote
if false
Test.record(Test.get_testset(), Test.Broken(:skipped, $(QuoteNode(:(1 == 2)))))
else
let var"#10#_do" = if false
Test.do_broken_test
else
Test.do_test
end
var"#10#_do"(begin
try
Test.eval_test(Test.Expr(:comparison, 1, ==, 2), Test.Expr(:comparison, $(QuoteNode(1)), :(==), $(QuoteNode(2))), $(QuoteNode(:(#= REPL[19]:1 =#))), $(QuoteNode(false)))
catch var"#12#_e"
var"#12#_e" isa Test.InterruptException && Test.rethrow()
Test.Threw(var"#12#_e", (Test.Base).current_exceptions(), $(QuoteNode(:(#= REPL[19]:1 =#)))) # <----------------
end
end, $(QuoteNode(:(1 == 2))))
end
end
end
If one tries to copy paste this expression and eval it one gets:
julia> eval(q)
ERROR: MethodError: Cannot `convert` an object of type Expr to an object of type LineNumberNode
The function `convert` exists, but no method is defined for this combination of argument types.
Closest candidates are:
convert(::Type{T}, ::T) where T
@ Base Base_compiler.jl:134
Stacktrace:
[1] Test.Threw(exception::Any, backtrace::Any, source::Any)
@ Test ~/.julia/juliaup/julia-1.12-nightly/share/julia/stdlib/v1.12/Test/src/Test.jl:345
[2] top-level scope
@ REPL[20]:15
[3] eval(m::Module, e::Any)
@ Core ./boot.jl:489
[4] top-level scope
@ REPL[21]:1
Because the $(QuoteNode(:(#= REPL[19]:1 =#))))
printing part gets parsed as
$(QuoteNode(:(())))
nickrobinson251
Metadata
Metadata
Assignees
Labels
display and printingAesthetics and correctness of printed representations of objects.Aesthetics and correctness of printed representations of objects.