Skip to content

Commit

Permalink
Simplify how we copy docstrings for MOI enums
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Nov 6, 2024
1 parent da8a667 commit 7979503
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1313,20 +1313,9 @@ function _eval_instances_in_jump(moi_enum)
# `eval` the instance as `const name = MOI.name`.
eval(Expr(:const, Expr(:(=), name, enum)))
# Documentation is not copied for a `const` expression of an object, so
# we need to manually set the docstring in this `@__MODULE__`.
# we need to manually set the docstring.
docstr = Docs.docstr(Docs.Binding(MOI, name))
d = Docs.DocStr(
docstr.text,
nothing,
Dict{Symbol,Any}(
:typesig => Union{},
:module => @__MODULE__,
:linenumber => @__LINE__,
:binding => getfield(@__MODULE__, name),
:path => @__FILE__,
),
)
Docs.doc!(@__MODULE__, Docs.Binding(@__MODULE__, name), d, Union{})
Docs.doc!(@__MODULE__, Docs.Binding(@__MODULE__, name), docstr)

Check warning on line 1318 in src/JuMP.jl

View check run for this annotation

Codecov / codecov/patch

src/JuMP.jl#L1318

Added line #L1318 was not covered by tests
end
return
end
Expand Down

0 comments on commit 7979503

Please sign in to comment.