Open
Description
Describe the bug 🐞
setu
does not perform sizecheck between the new values and the number of indexed elements.
Expected behavior
I would expect it to either error or implicitly broadcast, but it only overwrites a single value. The expectation comes especially when using the setindex!
interface, because then it feels like array indexing
a = zeros(2)
a[[1,2]] = 1 # errors
a[[1,2]] .= 1 # overwrites both elements
a[[1,2]] = [1,2] # overwrites both elements
Minimal Reproducible Example 👇
inpr = SymbolCache([:x, :y])
ps = ProblemState(;u=zeros(2))
getu(inpr, [:x,:y])(ps) == zeros(2) # as expected
setu(inpr, [:x,:y])(ps, 1) # does not error, only overwrites first element
getu(inpr, [:x,:y])(ps) == [1,0] # strange?