Skip to content

Commit

Permalink
Support for unsigned ints in array constructors (#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
joehuchette committed Oct 5, 2016
1 parent b5225ba commit d0c0adc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JuMPContainer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ function gendict(instancename,T,idxsets...)
end
sizes = Expr(:tuple, [:(length($rng)) for rng in idxsets]...)
if truearray
:($instancename = Array($T, $sizes))
:($instancename = Array($T, $sizes...))
else
indexsets = Expr(:tuple, idxsets...)
:($instancename = JuMPArray(Array($T, $sizes), $indexsets))
:($instancename = JuMPArray(Array($T, $sizes...), $indexsets))
end
end

Expand Down
7 changes: 7 additions & 0 deletions test/variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,10 @@ facts("[variable] Can't use end for indexing a JuMPContainer") do
@fact_throws y[end,1]
@fact_throws z[end]
end

facts("[variable] Unsigned dimension lengths") do
m = Model()
t = UInt(4)
@variable(m, x[1:t])
@constraintref(y[1:t])
end

0 comments on commit d0c0adc

Please sign in to comment.