Skip to content

Commit

Permalink
Merge pull request #350 from willow-ahrens/wma/fix319
Browse files Browse the repository at this point in the history
ensure the errors are defined
  • Loading branch information
willow-ahrens authored Dec 12, 2023
2 parents 1a3555e + c2e027e commit ac9af0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/SparseArraysExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using Finch
using Finch: AbstractCompiler, DefaultStyle, Extent
using Finch: Unfurled, Furlable, Stepper, Jumper, Run, Fill, Lookup, Simplify, Sequence, Phase, Thunk, Spike
using Finch: virtual_size, virtual_default, getstart, getstop, freshen, SwizzleArray
using Finch: FinchProtocolError
using Finch.FinchNotation

using Base: @kwdef
Expand Down Expand Up @@ -153,7 +154,7 @@ function Finch.instantiate(arr::VirtualSparseMatrixCSC, ctx::AbstractCompiler, m
end

function Finch.instantiate(arr::VirtualSparseMatrixCSC, ctx::AbstractCompiler, mode::Updater, subprotos, protos...)
throw(Finch.FinchProtocolError("Finch does not support writes to SparseMatrixCSC"))
throw(FinchProtocolError("Finch does not support writes to SparseMatrixCSC"))
end

Finch.FinchNotation.finch_leaf(x::VirtualSparseMatrixCSC) = virtual(x)
Expand Down Expand Up @@ -260,7 +261,7 @@ function Finch.instantiate(arr::VirtualSparseVector, ctx::AbstractCompiler, mode
end

function Finch.instantiate(arr::VirtualSparseVector, ctx::AbstractCompiler, mode::Updater, subprotos)
throw(Finch.FinchProtocolError("Finch does not support writes to SparseVector"))
throw(FinchProtocolError("Finch does not support writes to SparseVector"))
end

Finch.FinchNotation.finch_leaf(x::VirtualSparseVector) = virtual(x)
Expand Down
5 changes: 5 additions & 0 deletions test/test_issues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@ using CIndices
@finch (output_tensor .=0; for j=_,i=_,k=_; output_tensor[i,k] += a_fiber[i,j] * b_fiber[k,j]; end)
end

#https://github.com/willow-ahrens/Finch.jl/issues/319
let
x = SparseMatrixCSC(spzeros(2,2))
@test_throws Finch.FinchProtocolError @finch x .= 0
end
#https://github.com/willow-ahrens/Finch.jl/issues/321
let
A = fsprand((10, 10), 0.1)
Expand Down

0 comments on commit ac9af0f

Please sign in to comment.