Skip to content

Remove ArrayInterfaceCore can_setindex type piracy (resolves #68)#70

Merged
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:remove-arrayinterfacecore-piracy
Jun 27, 2026
Merged

Remove ArrayInterfaceCore can_setindex type piracy (resolves #68)#70
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:remove-arrayinterfacecore-piracy

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Resolves #68.

Summary

Removes the type piracy in src/ComplementaritySolve.jl:

ArrayInterfaceCore.can_setindex(::Type{<:AbstractFill}) = false
ArrayInterfaceCore.can_setindex(::Zygote.OneElement) = false

and re-enables the Aqua piracy check (drops piracies = (; broken = true)).

Why this is safe

  • The methods were dead. They target ArrayInterfaceCore.can_setindex (the deprecated 0.1 package), but the current solver stack (LinearSolve/NonlinearSolve) dispatches on ArrayInterface.can_setindex — a different function. Nothing in this package calls can_setindex itself; ArrayInterfaceCore was imported solely to host these two definitions.
  • AbstractFill/OneElement immutability now lives upstream. Added in ArrayInterface via a FillArrays extension: Add FillArrays extension for can_setindex JuliaArrays/ArrayInterface.jl#493. It loads automatically here because FillArrays is already a dependency and ArrayInterface is present transitively (via LinearSolve), so no new direct dependency is needed.
  • Zygote.OneElement is no longer produced by Zygote. In current Zygote (0.7.x) the type is defined but never constructed; getindex gradients flow through ChainRules.OneElement, which ArrayInterface already covers (ArrayInterfaceChainRulesExt).

The unused ArrayInterfaceCore dependency (deps + compat) is dropped.

Testing

TESTING_GROUP=QA suite (Aqua + ExplicitImports) run locally and passes 6/6 with the piracy check fully enabled — against the registry ArrayInterface (i.e. before #493 releases), confirming no regression in the interim.

Note: depends conceptually on JuliaArrays/ArrayInterface.jl#493 for the immutability behavior, but is independently correct and mergeable now since the removed piracy was dead.

Draft — please ignore until reviewed by @ChrisRackauckas.

🤖 Generated with Claude Code

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 SciML#68.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Comment thread src/ComplementaritySolve.jl Outdated
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review June 27, 2026 11:44
@ChrisRackauckas ChrisRackauckas merged commit 8d569ee into SciML:main Jun 27, 2026
11 checks passed
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.

QA: Aqua piracies known-broken (intentional ArrayInterfaceCore.can_setindex piracy)

2 participants