Skip to content

Commit

Permalink
Merge branch 'main' into kmp5/debug/1438
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored May 14, 2024
2 parents 4c20a00 + 296f343 commit 1d008ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NDTensors/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NDTensors"
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
authors = ["Matthew Fishman <[email protected]>"]
version = "0.3.5"
version = "0.3.6"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
2 changes: 1 addition & 1 deletion NDTensors/src/lib/SparseArrayDOKs/src/sparsearraydok.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,5 @@ macro maybe_grow(expr)
)
end
@capture(expr, array_[indices__] = value_)
return :(setindex_maybe_grow!($(esc(array)), $value, $indices...))
return :(setindex_maybe_grow!($(esc(array)), $(esc(value)), $(esc.(indices)...)))
end
9 changes: 9 additions & 0 deletions NDTensors/src/lib/SparseArrayDOKs/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ using SparseArrays: SparseMatrixCSC, nnz
@maybe_grow v[5] = 50
@test size(v) == (5,)
@test v[5] == 50
# Test setting from a variable (to test macro escaping)
i = 6
val = 60
@maybe_grow v[i] = val
@test v[i] == val
i, j = 1, 2
val = 120
@maybe_grow a[i, j] = val
@test a[i, j] == val
end
@testset "Test Lower Level Constructor" begin
d = Dictionary{CartesianIndex{2},elt}()
Expand Down

0 comments on commit 1d008ce

Please sign in to comment.