Skip to content

promote not working #1785

@blegat

Description

@blegat
julia> f = 1 * MOI.VariableIndex(1)
MathOptInterface.ScalarAffineFunction{Int64}(MathOptInterface.ScalarAffineTerm{Int64}[MathOptInterface.ScalarAffineTerm{Int64}(1, MathOptInterface.VariableIndex(1))], 0)

julia> g = 1.0 * f
MathOptInterface.ScalarAffineFunction{Float64}(MathOptInterface.ScalarAffineTerm{Float64}[MathOptInterface.ScalarAffineTerm{Float64}(1.0, MathOptInterface.VariableIndex(1))], 0.0)

julia> promote(f, g)
ERROR: promotion of types MathOptInterface.ScalarAffineFunction{Int64} and MathOptInterface.ScalarAffineFunction{Float64} failed to change any arguments
Stacktrace:
 [1] error(::String, ::String, ::String)
   @ Base ./error.jl:42
 [2] sametype_error(input::Tuple{MathOptInterface.ScalarAffineFunction{Int64}, MathOptInterface.ScalarAffineFunction{Float64}})
   @ Base ./promotion.jl:374
 [3] not_sametype(x::Tuple{MathOptInterface.ScalarAffineFunction{Int64}, MathOptInterface.ScalarAffineFunction{Float64}}, y::Tuple{MathOptInterface.ScalarAffineFunction{Int64}, MathOptInterface.ScalarAffineFunction{Float64}})
   @ Base ./promotion.jl:368
 [4] promote(x::MathOptInterface.ScalarAffineFunction{Int64}, y::MathOptInterface.ScalarAffineFunction{Float64})
   @ Base ./promotion.jl:351
 [5] top-level scope
   @ REPL[10]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions