@@ -3,6 +3,14 @@ CurrentModule = MathOptInterface
33DocTestSetup = quote
44 using MathOptInterface
55 const MOI = MathOptInterface
6+
7+ # For compatibility with both Julia 1.0.5 and 1.5.2
8+ # Upon the Julia LTS version becoming 1.6, these imports could be dropped,
9+ # and all ScalarAffineTerm and VariableIndex instances in doctests below
10+ # could be replaced with MOI.ScalarAffineTerm and MOI.VariableIndex
11+ # Check discussion at PR 1184: https://github.com/jump-dev/MathOptInterface.jl/pull/1184#discussion_r515300914
12+ import MathOptInterface.ScalarAffineTerm
13+ import MathOptInterface.VariableIndex
614end
715DocTestFilters = [r"MathOptInterface|MOI"]
816```
@@ -625,7 +633,7 @@ bridged_variable, bridged_constraint = MOI.add_constrained_variable(bridged_mode
625633
626634# output
627635
628- (MOI. VariableIndex(-1), MOI.ConstraintIndex{MOI.SingleVariable,MOI.GreaterThan{Float64}}(-1))
636+ (VariableIndex(-1), MOI.ConstraintIndex{MOI.SingleVariable,MOI.GreaterThan{Float64}}(-1))
629637```
630638The constrained variable in ` MOI.GreaterThan(1.0) ` returned is a bridged
631639variable as its index in negative. In ` model ` , a constrained variable in
@@ -635,8 +643,8 @@ inner_variables = MOI.get(model, MOI.ListOfVariableIndices())
635643
636644# output
637645
638- 1-element Array{MOI. VariableIndex,1}:
639- MOI. VariableIndex(1)
646+ 1-element Array{VariableIndex,1}:
647+ VariableIndex(1)
640648```
641649In the functions used for adding constraints or setting the objective to
642650` bridged_model ` , ` bridged_variable ` is substituted for ` inner_variables[1] ` plus
0 commit comments