Skip to content
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

Fix tests for Julia v1.4-rc1 #1010

Merged
merged 3 commits into from
Jan 28, 2020
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ julia:
- 1.1
- 1.2
- 1.3
- 1.4
notifications:
email: false
git:
Expand Down
10 changes: 10 additions & 0 deletions src/Utilities/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/Bridges/Variable/vectorize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion test/Utilities/copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down