Add FillArrays extension for can_setindex#493
Merged
ChrisRackauckas merged 1 commit intoJun 27, 2026
Merged
Conversation
`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>
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
ArrayInterfaceFillArraysExt, defining:FillArraysfills andOneElementare immutable lazy arrays —setindex!is not defined for them — socan_setindexshould reportfalse. Currently they fall through to the defaulttrue. This mirrors the existingArrayInterfaceChainRulesExthandling ofChainRules.OneElementand the StaticArrays/Tracker/ReverseDiff extensions.Motivation
SciML/ComplementaritySolve.jlcarried a local type piracy defining exactly thesecan_setindexmethods (on the deprecatedArrayInterfaceCore) to make solver paths treat lazy fills as immutable. Moving the definitions here — where thecan_setindexfunction is owned — lets that package drop the piracy (SciML/ComplementaritySolve.jl#68).Testing
test/fillarrays.jl(wired into the Core group ofruntests.jl).GROUP=Coresuite run locally and passes, including the newFillArraystestset (7/7) and the existingcan_setindextests.Draft — please ignore until reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code