Skip to content

Fix type stability of Base.RefValue fields #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Returns the SCIP expression pointer, whether the expression is a pure value (wit
function push_expr!(
nonlin::NonlinExpr,
scip::Ptr{SCIP_},
vars::Dict{VarRef,Ref{Ptr{SCIP_VAR}}},
vars::Dict{VarRef,<:Ref{Ptr{SCIP_VAR}}},
expr::Expr,
)
# Storage for SCIP_EXPR*
Expand Down Expand Up @@ -262,7 +262,7 @@ end
function push_expr!(
nonlin::NonlinExpr,
scip::Ptr{SCIP_},
vars::Dict{VarRef,Ref{Ptr{SCIP_VAR}}},
vars::Dict{VarRef,<:Ref{Ptr{SCIP_VAR}}},
expr::Number,
)
# Storage for SCIP_EXPR*
Expand Down
10 changes: 5 additions & 5 deletions src/scip_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ SCIPData holds pointers to SCIP data.
It does not perform memory management and should not be created directly.
"""
mutable struct SCIPData
scip::Ref{Ptr{SCIP_}}
vars::Dict{VarRef,Ref{Ptr{SCIP_VAR}}}
conss::Dict{ConsRef,Ref{Ptr{SCIP_CONS}}}
scip::Base.RefValue{Ptr{SCIP_}}
vars::Dict{VarRef,Base.RefValue{Ptr{SCIP_VAR}}}
conss::Dict{ConsRef,Base.RefValue{Ptr{SCIP_CONS}}}

var_count::Int64
cons_count::Int64
Expand Down Expand Up @@ -69,8 +69,8 @@ mutable struct SCIPData
@SCIP_CALL SCIPcreateProbBasic(scip[], "")
scip_data = new(
scip,
Dict{VarRef,Ref{Ptr{SCIP_VAR}}}(),
Dict{ConsRef,Ref{Ptr{SCIP_CONS}}}(),
Dict{VarRef,Base.RefValue{Ptr{SCIP_VAR}}}(),
Dict{ConsRef,Base.RefValue{Ptr{SCIP_CONS}}}(),
0,
0,
Dict{Any,Ptr{SCIP_CONSHDLR}}(),
Expand Down
2 changes: 1 addition & 1 deletion src/sepa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ associated to the separator `sepa`.
"""
function add_cut_sepa(
scip::Ptr{SCIP_},
vars::Dict{VarRef,Ref{Ptr{SCIP_VAR}}},
vars::Dict{VarRef,<:Ref{Ptr{SCIP_VAR}}},
sepas::Dict{Any,Ptr{SCIP_SEPA}},
sepa::SEPA,
varrefs,
Expand Down
Loading