From 28a8f1f68e02054f8d66e9d4e772e8246ee5134c Mon Sep 17 00:00:00 2001 From: odow Date: Tue, 5 Nov 2024 13:35:38 +1300 Subject: [PATCH] Remove dead code in getindex(::AbstractModel, ::Symbol) --- src/JuMP.jl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/JuMP.jl b/src/JuMP.jl index 11589b51419..b26532e9c8e 100644 --- a/src/JuMP.jl +++ b/src/JuMP.jl @@ -1068,15 +1068,6 @@ function Base.getindex(m::AbstractModel, name::Symbol) obj_dict = object_dictionary(m) if !haskey(obj_dict, name) throw(KeyError(name)) - elseif obj_dict[name] === nothing - error( - "There are multiple variables and/or constraints named $name " * - "that are already attached to this model. If creating variables " * - "programmatically, use the anonymous variable syntax " * - "`x = @variable(m, [1:N], ...)`. If creating constraints " * - "programmatically, use the anonymous constraint syntax " * - "`con = @constraint(m, ...)`.", - ) end return obj_dict[name] end