Skip to content

Subtle trap with semicolon syntax #2318

@mlubin

Description

@mlubin
julia> m = Model();

julia> @variable(m, x[i=1:4; iseven(i)])
JuMP.Containers.SparseAxisArray{VariableRef,1,Tuple{Int64}} with 2 entries:
  [4]  =  x[4]
  [2]  =  x[2]

julia> @variable(m, y[i=1:4, iseven(i)])
JuMP.Containers.SparseAxisArray{VariableRef,2,Tuple{Int64,Bool}} with 4 entries:
  [1, false]  =  y[1,false]
  [3, false]  =  y[3,false]
  [4, true ]  =  y[4,true]
  [2, true ]  =  y[2,true]

I'm not sure how to fix this, but it's unfortunate that a one-character change that's hard to spot can have this subtle effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions