diff --git a/src/utils.jl b/src/utils.jl index a41161f..5163c3b 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -16,13 +16,17 @@ macro required(sig) model_arg = model_arg_ex.args[1] model_arg isa Symbol || error("malformed signature definition") - return esc( - quote - Base.@__doc__ $call_ex = $unimplemented(typeof($model_arg), $(Meta.quot(name))) - push!(REQUIRED_ACCESSORS, $name) - $name - end, + # magic to use the call-site line numbers so methods includes them + def = Expr( + :(=), + call_ex, + Expr(:block, __source__, :($unimplemented(typeof($model_arg), $(Meta.quot(name))))), ) + return esc(quote + $def + push!(REQUIRED_ACCESSORS, $name) + Base.@__doc__ $name + end) end unimplemented(t::Type, x::Symbol) =