Skip to content

Add FillArrays extension for can_setindex#493

Merged
ChrisRackauckas merged 1 commit into
JuliaArrays:masterfrom
ChrisRackauckas-Claude:fillarrays-can-setindex-ext
Jun 27, 2026
Merged

Add FillArrays extension for can_setindex#493
ChrisRackauckas merged 1 commit into
JuliaArrays:masterfrom
ChrisRackauckas-Claude:fillarrays-can-setindex-ext

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown

Summary

Adds ArrayInterfaceFillArraysExt, defining:

ArrayInterface.can_setindex(::Type{<:AbstractFill}) = false   # Fill, Ones, Zeros
ArrayInterface.can_setindex(::Type{<:OneElement})  = false    # FillArrays.OneElement

FillArrays fills and OneElement are immutable lazy arrays — setindex! is not defined for them — so can_setindex should report false. Currently they fall through to the default true. This mirrors the existing ArrayInterfaceChainRulesExt handling of ChainRules.OneElement and the StaticArrays/Tracker/ReverseDiff extensions.

Motivation

SciML/ComplementaritySolve.jl carried a local type piracy defining exactly these can_setindex methods (on the deprecated ArrayInterfaceCore) to make solver paths treat lazy fills as immutable. Moving the definitions here — where the can_setindex function is owned — lets that package drop the piracy (SciML/ComplementaritySolve.jl#68).

Testing

  • New test/fillarrays.jl (wired into the Core group of runtests.jl).
  • Full GROUP=Core suite run locally and passes, including the new FillArrays testset (7/7) and the existing can_setindex tests.

Draft — please ignore until reviewed by @ChrisRackauckas.

🤖 Generated with Claude Code

`FillArrays.AbstractFill` (Fill/Ones/Zeros) and `FillArrays.OneElement` are
immutable lazy arrays, so `can_setindex` should report `false` for them. This
mirrors the existing ChainRules `OneElement` handling and lets downstream
packages (e.g. SciML/ComplementaritySolve.jl) drop a type-piracy workaround
that previously defined these methods locally.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review June 27, 2026 11:39
@ChrisRackauckas ChrisRackauckas merged commit 5d564fa into JuliaArrays:master Jun 27, 2026
16 of 19 checks passed
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.00%. Comparing base (ebd8f9c) to head (5539b55).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
ext/ArrayInterfaceFillArraysExt.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #493      +/-   ##
==========================================
- Coverage   60.20%   60.00%   -0.21%     
==========================================
  Files          14       15       +1     
  Lines         588      590       +2     
==========================================
  Hits          354      354              
- Misses        234      236       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ChrisRackauckas added a commit to SciML/ComplementaritySolve.jl that referenced this pull request Jun 27, 2026
* Remove ArrayInterfaceCore can_setindex type piracy

The package defined `can_setindex` for `FillArrays.AbstractFill` and
`Zygote.OneElement` on `ArrayInterfaceCore` (function owned by ArrayInterface,
types owned by FillArrays/Zygote) — type piracy that Aqua only tolerated via
`piracies = (; broken = true)`.

These methods were also effectively dead: they target the deprecated
`ArrayInterfaceCore.can_setindex`, while the current solver stack
(LinearSolve/NonlinearSolve) dispatches on `ArrayInterface.can_setindex`.
The `AbstractFill`/`OneElement` immutability is now provided upstream by
ArrayInterface's FillArrays extension (JuliaArrays/ArrayInterface.jl#493),
which loads automatically since FillArrays is already a dependency.
`Zygote.OneElement` is no longer constructed by current Zygote (gradients
route through `ChainRules.OneElement`, already covered upstream).

Drops the unused `ArrayInterfaceCore` dependency and re-enables the Aqua
piracy check. Resolves #68.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>

* Apply suggestion from @ChrisRackauckas

---------

Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants