Skip to content

Commit 061c0c9

Browse files
committed
Add can_setindex for ChainRules OneElement
1 parent 36ae9e5 commit 061c0c9

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "7.8.1"
3+
version = "7.9.0"
44

55
[deps]
66
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -12,6 +12,7 @@ SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
1212
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
1313
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
1414
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
15+
ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2"
1516
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
1617
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
1718
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
@@ -21,6 +22,7 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
2122
ArrayInterfaceBandedMatricesExt = "BandedMatrices"
2223
ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices"
2324
ArrayInterfaceCUDAExt = "CUDA"
25+
ArrayInterfaceChainRulesExt = "ChainRules"
2426
ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore"
2527
ArrayInterfaceReverseDiffExt = "ReverseDiff"
2628
ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore"
@@ -38,6 +40,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3840
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
3941
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
4042
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
43+
ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2"
4144
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
4245
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
4346
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
@@ -51,4 +54,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5154
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
5255

5356
[targets]
54-
test = ["SafeTestsets", "Pkg", "Test", "Aqua", "Random", "SparseArrays", "SuiteSparse", "BandedMatrices", "BlockBandedMatrices", "GPUArraysCore", "StaticArrays", "StaticArraysCore", "Tracker", "ReverseDiff"]
57+
test = ["SafeTestsets", "Pkg", "Test", "Aqua", "Random", "SparseArrays", "SuiteSparse", "BandedMatrices", "BlockBandedMatrices", "GPUArraysCore", "StaticArrays", "StaticArraysCore", "Tracker", "ReverseDiff", "ChainRules"]

ext/ArrayInterfaceChainRulesExt.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module ArrayInterfaceChainRulesExt
2+
3+
using ArrayInterface
4+
using ChainRules: OneElement
5+
6+
ArrayInterface.can_setindex(::Type{<:OneElement}) = false
7+
8+
end

test/chainrules.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using ArrayInterface, ChainRules, Test
2+
3+
x = ChainRules.OneElement(3.0, (3, 3), (1:4, 1:4))
4+
5+
@test !ArrayInterface.can_setindex(x)
6+
@test !ArrayInterface.can_setindex(typeof(x))

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ end
1515
@time @safetestset "Core" begin include("core.jl") end
1616
@time @safetestset "AD Integration" begin include("ad.jl") end
1717
@time @safetestset "StaticArraysCore" begin include("staticarrayscore.jl") end
18+
@time @safetestset "ChainRules" begin include("chainrules.jl") end
1819
end
1920

2021
if GROUP == "GPU"

0 commit comments

Comments
 (0)