Skip to content

Commit

Permalink
Merge pull request #28 from oxinabox/ox/unbreak_line_numbers
Browse files Browse the repository at this point in the history
Define line numbers for functions defined using required macro
  • Loading branch information
exaexa authored Oct 8, 2024
2 parents 67e5483 + 6b8af68 commit f5503b2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down

2 comments on commit f5503b2

@exaexa
Copy link
Member Author

@exaexa exaexa commented on f5503b2 Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/116809

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.0 -m "<description of version>" f5503b28ecdf8e9fd9dfb53327f17c628d833d0f
git push origin v1.1.0

Please sign in to comment.