Skip to content

Commit 5df5ec9

Browse files
authored
Merge pull request #1010 from JuliaOpt/bl/j1.4
Fix tests for Julia v1.4-rc1
2 parents 344a671 + 4bb6186 commit 5df5ec9

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ julia:
99
- 1.1
1010
- 1.2
1111
- 1.3
12+
- 1.4
1213
notifications:
1314
email: false
1415
git:

src/Utilities/functions.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,16 @@ end
15421542
function Base.:*(f::Union{MOI.SingleVariable, MOI.VectorOfVariables}, g::Number)
15431543
return operate(*, typeof(g), f, g)
15441544
end
1545+
# Used by sparse matrix multiplication after
1546+
# https://github.com/JuliaLang/julia/pull/33205
1547+
function Base.:*(f::TypedLike, g::Bool)
1548+
if g
1549+
return MA.copy_if_mutable(f)
1550+
else
1551+
return zero(typeof(f))
1552+
end
1553+
end
1554+
Base.:*(f::Bool, g::TypedLike) = g * f
15451555

15461556
function Base.:^(func::MOI.ScalarAffineFunction{T}, p::Integer) where T
15471557
if iszero(p)

test/Bridges/Variable/vectorize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ end
115115

116116
@testset "MultirowChange" begin
117117
change = MOI.MultirowChange(y, [(3, 0.0)])
118-
message = "The change MathOptInterface.MultirowChange{Float64}(MathOptInterface.VariableIndex(-1), Tuple{Int64,Float64}[(3, 0.0)])" *
118+
message = "The change $change" *
119119
" contains variables bridged into a function with nonzero constant."
120120
err = MOI.ModifyConstraintNotAllowed(cis[1], change, message)
121121
@test_throws err MOI.modify(bridged_mock, cis[1], change)

test/Utilities/copy.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ end
2222
map = MOIU.IndexMap(Dict(x => y), Dict(cx => cy))
2323
@test length(map) == 2
2424
# `x=>y` in Julia <= 1.1 and `x => y` in Julia >= 1.2
25-
x_y = string(Dict(x => y))[6:end-1]
25+
if VERSION < v"1.2"
26+
x_y = string(x) * "=>" * string(y)
27+
else
28+
x_y = string(x => y)
29+
end
2630
compare_without_moi(sprint(show, map), "Utilities.IndexMap($x_y,Pair{ConstraintIndex,ConstraintIndex}($cx, $cy))")
2731
end
2832

0 commit comments

Comments
 (0)