-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
Hi
Reproducible example:
macro makefn(name)
name = Symbol(name)
quote
$(esc(name))() = print("hello")
end
end
julia> @makefn f
f (generic function with 1 method)
julia> f()
hello
julia> @code_string f()
ERROR: MethodError: no method matching +(::Nothing, ::Int64)
Closest candidates are:
+(::Any, ::Any, ::Any, ::Any...) at /usr/share/julia/base/operators.jl:655
+(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at /usr/share/julia/base/int.jl:87
+(::Base.TwicePrecision, ::Number) at /usr/share/julia/base/twiceprecision.jl:279
...
Stacktrace:
[1] definition(#unused#::Type{String}, method::Method)
@ CodeTracking ~/.julia/packages/CodeTracking/zfc7r/src/CodeTracking.jl:230
[2] code_string(f::Function, t::Type)
@ CodeTracking ~/.julia/packages/CodeTracking/zfc7r/src/CodeTracking.jl:299
[3] top-level scope
@ REPL[5]:1
Metadata
Metadata
Assignees
Labels
No labels