Skip to content

Commit 84efa5f

Browse files
authored
Merge pull request #456 from JuliaOpt/bl/deletefallback
Fix delete fallback
2 parents 253e16c + 1a40cd2 commit 84efa5f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/indextypes.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ by the model.
5959
struct UnsupportedDeletion{IndexType<:Index} <: UnsupportedError
6060
message::String
6161
end
62+
function UnsupportedDeletion{IndexType}() where IndexType <: Index
63+
UnsupportedDeletion{IndexType}("")
64+
end
6265

6366
function operation_name(::UnsupportedDeletion{IndexType}) where {IndexType<:Index}
6467
return "Deleting indices of type `$IndexType`"

test/attributes.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ end
44
@testset "Fallbacks for `set!` methods" begin
55
model = DummyModel()
66
ci = MOI.ConstraintIndex{MOI.SingleVariable, MOI.EqualTo{Float64}}(1)
7+
8+
@test_throws MOI.UnsupportedDeletion{typeof(ci)} MOI.delete!(model, ci)
9+
710
@testset "ConstraintFunction" begin
811
vi = MOI.VariableIndex(1)
912
@test_throws MOI.UnsupportedAttribute begin

0 commit comments

Comments
 (0)