diff --git a/src/Bridges/Bridges.jl b/src/Bridges/Bridges.jl index ccfe3bd869..8251eb0d32 100644 --- a/src/Bridges/Bridges.jl +++ b/src/Bridges/Bridges.jl @@ -302,13 +302,13 @@ function runtests( end # Test other bridge functions for b in values(Constraint.bridges(model)) - _general_bridge_tests(b) + _general_bridge_tests(something(b)) end for b in values(Objective.bridges(model)) - _general_bridge_tests(b) + _general_bridge_tests(something(b)) end for b in values(Variable.bridges(model)) - _general_bridge_tests(b) + _general_bridge_tests(something(b)) end _test_delete(Bridge, model, inner) return diff --git a/src/Bridges/Variable/map.jl b/src/Bridges/Variable/map.jl index 7e664cc5b9..014c4847b3 100644 --- a/src/Bridges/Variable/map.jl +++ b/src/Bridges/Variable/map.jl @@ -71,7 +71,7 @@ function Base.empty!(map::Map) map.unbridged_function = Dict{MOI.VariableIndex,Tuple{Int64,MOI.AbstractScalarFunction}}() else - empty!(map.unbridged_function) + empty!(something(map.unbridged_function)) end empty!(map.parent_index) map.current_context = 0 @@ -371,13 +371,14 @@ function add_keys_for_bridge( MOI.VariableIndex(-(bridge_index - 1 + i)) for i in 1:MOI.dimension(set) ] if map.unbridged_function !== nothing - mappings = unbridged_map(map.bridges[bridge_index], variables) + mappings = + unbridged_map(something(map.bridges[bridge_index]), variables) if mappings === nothing map.unbridged_function = nothing else for mapping in mappings push!( - map.unbridged_function, + something(map.unbridged_function), mapping.first => (bridge_index, mapping.second), ) end @@ -441,7 +442,7 @@ Return the expression of `vi` in terms of bridged variables. """ function unbridged_function(map::Map, vi::MOI.VariableIndex) throw_if_cannot_unbridge(map) - context_func = get(map.unbridged_function, vi, nothing) + context_func = get(something(map.unbridged_function), vi, nothing) if context_func === nothing return nothing end diff --git a/src/Nonlinear/evaluator.jl b/src/Nonlinear/evaluator.jl index 21955c14d1..2414ac7db1 100644 --- a/src/Nonlinear/evaluator.jl +++ b/src/Nonlinear/evaluator.jl @@ -90,7 +90,7 @@ function MOI.objective_expr(evaluator::Evaluator) end return convert_to_expr( evaluator, - evaluator.model.objective; + something(evaluator.model.objective); moi_output_format = true, ) end diff --git a/src/Nonlinear/operators.jl b/src/Nonlinear/operators.jl index ee49768111..d318fdb241 100644 --- a/src/Nonlinear/operators.jl +++ b/src/Nonlinear/operators.jl @@ -575,7 +575,7 @@ function eval_univariate_hessian( ) where {T} id = registry.univariate_operator_to_id[op] if id <= registry.univariate_user_operator_start - return _eval_univariate_2nd_deriv(id, x) + return _eval_univariate_2nd_deriv(id, x)::T end offset = id - registry.univariate_user_operator_start operator = registry.registered_univariate_operators[offset] diff --git a/src/Utilities/universalfallback.jl b/src/Utilities/universalfallback.jl index 21842f53a5..c57df71d7b 100644 --- a/src/Utilities/universalfallback.jl +++ b/src/Utilities/universalfallback.jl @@ -280,7 +280,7 @@ function MOI.delete(uf::UniversalFallback, vi::MOI.VariableIndex) delete!(d, vi) end if uf.objective !== nothing - uf.objective = remove_variable(uf.objective, vi) + uf.objective = remove_variable(something(uf.objective), vi) end for constraints in values(uf.single_variable_constraints) _remove_variable(uf, constraints, vi) @@ -309,7 +309,7 @@ function MOI.delete(uf::UniversalFallback, vis::Vector{MOI.VariableIndex}) end end if uf.objective !== nothing - uf.objective = remove_variable(uf.objective, vis) + uf.objective = remove_variable(something(uf.objective), vis) end for constraints in values(uf.single_variable_constraints) for vi in vis @@ -678,7 +678,7 @@ function MOI.get( # to check for duplicate names. MOI.get(uf.model, MOI.ConstraintIndex, name) end - ci_uf = get(uf.name_to_con, name, nothing) + ci_uf = get(something(uf.name_to_con), name, nothing) throw_if_multiple_with_name(ci_uf, name) c = check_type_and_multiple_names(MOI.ConstraintIndex{F,S}, ci_uf, ci, name) return c @@ -692,7 +692,7 @@ function MOI.get( if uf.name_to_con === nothing uf.name_to_con = build_name_to_con_map(uf.con_to_name) end - ci_uf = get(uf.name_to_con, name, nothing) + ci_uf = get(something(uf.name_to_con), name, nothing) throw_if_multiple_with_name(ci_uf, name) return check_type_and_multiple_names( MOI.ConstraintIndex,