Skip to content

Remove convert methods which cause method invalidations #2278

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

Merged
merged 1 commit into from
Nov 26, 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
7 changes: 0 additions & 7 deletions src/aff_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,6 @@ end
function Base.convert(::Type{GenericAffExpr{T,V}}, v::_Constant) where {T,V}
return GenericAffExpr{T,V}(convert(T, _constant_to_number(v)))
end
# Used in `JuMP._mul!`.
function Base.convert(::Type{T}, aff::GenericAffExpr{T}) where T
if !isempty(aff.terms)
throw(InexactError(:convert, T, aff))
end
return convert(T, aff.constant)
end

# Alias for (Float64, VariableRef), the specific GenericAffExpr used by JuMP
const AffExpr = GenericAffExpr{Float64,VariableRef}
Expand Down
7 changes: 0 additions & 7 deletions src/quad_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,6 @@ function Base.convert(::Type{GenericQuadExpr{C, V}}, v::Union{_Constant,Abstract
return GenericQuadExpr(convert(GenericAffExpr{C, V}, v))
end
GenericQuadExpr{C, V}() where {C, V} = zero(GenericQuadExpr{C, V})
# Used in `JuMP._mul!`.
function Base.convert(::Type{T}, quad::GenericQuadExpr{T}) where T
if !isempty(quad.terms)
throw(InexactError(:convert, T, quad))
end
return convert(T, quad.aff)
end

function check_belongs_to_model(q::GenericQuadExpr, model::AbstractModel)
check_belongs_to_model(q.aff, model)
Expand Down