diff --git a/.travis.yml b/.travis.yml index 2906abcbb9..9ddd61d8e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ julia: - 1.1 - 1.2 - 1.3 + - 1.4 notifications: email: false git: diff --git a/src/Utilities/functions.jl b/src/Utilities/functions.jl index e2dad3e088..0bd4ac8dcc 100644 --- a/src/Utilities/functions.jl +++ b/src/Utilities/functions.jl @@ -1542,6 +1542,16 @@ end function Base.:*(f::Union{MOI.SingleVariable, MOI.VectorOfVariables}, g::Number) return operate(*, typeof(g), f, g) end +# Used by sparse matrix multiplication after +# https://github.com/JuliaLang/julia/pull/33205 +function Base.:*(f::TypedLike, g::Bool) + if g + return MA.copy_if_mutable(f) + else + return zero(typeof(f)) + end +end +Base.:*(f::Bool, g::TypedLike) = g * f function Base.:^(func::MOI.ScalarAffineFunction{T}, p::Integer) where T if iszero(p) diff --git a/test/Bridges/Variable/vectorize.jl b/test/Bridges/Variable/vectorize.jl index 08f56b1352..81f6ff58e4 100644 --- a/test/Bridges/Variable/vectorize.jl +++ b/test/Bridges/Variable/vectorize.jl @@ -115,7 +115,7 @@ end @testset "MultirowChange" begin change = MOI.MultirowChange(y, [(3, 0.0)]) - message = "The change MathOptInterface.MultirowChange{Float64}(MathOptInterface.VariableIndex(-1), Tuple{Int64,Float64}[(3, 0.0)])" * + message = "The change $change" * " contains variables bridged into a function with nonzero constant." err = MOI.ModifyConstraintNotAllowed(cis[1], change, message) @test_throws err MOI.modify(bridged_mock, cis[1], change) diff --git a/test/Utilities/copy.jl b/test/Utilities/copy.jl index 2bfd454d78..93e03c2e04 100644 --- a/test/Utilities/copy.jl +++ b/test/Utilities/copy.jl @@ -22,7 +22,11 @@ end map = MOIU.IndexMap(Dict(x => y), Dict(cx => cy)) @test length(map) == 2 # `x=>y` in Julia <= 1.1 and `x => y` in Julia >= 1.2 - x_y = string(Dict(x => y))[6:end-1] + if VERSION < v"1.2" + x_y = string(x) * "=>" * string(y) + else + x_y = string(x => y) + end compare_without_moi(sprint(show, map), "Utilities.IndexMap($x_y,Pair{ConstraintIndex,ConstraintIndex}($cx, $cy))") end