Remove name shadows, dead aliases, and unused imports in linalg and broadcasting - #779
Open
ViralBShah wants to merge 1 commit into
Open
Remove name shadows, dead aliases, and unused imports in linalg and broadcasting#779ViralBShah wants to merge 1 commit into
ViralBShah wants to merge 1 commit into
Conversation
…roadcasting - `src/linalg.jl` defined an unqualified `_generic_matmatmul!`, creating a SparseArrays-local function while the same file calls `LinearAlgebra._generic_matmatmul!` (qualified) for dense destinations. Rename the local one to `_generic_spmatmatmul!`. Same for the local `_mul!` used by the symmetric/Hermitian path, now `_symherm_mul!`, versus the extension of `LinearAlgebra._mul!`. - Drop the pre-1.10 `top_set_bit` shim (which also shadowed `Base.top_set_bit`) and call `Base.top_set_bit` directly. - Remove unused aliases `DenseTriangular` and `DenseVecOrMat` (the latter shadowed the exported `Base.DenseVecOrMat` with a different meaning), the unused `SpBroadcasted2`, and a nine-line commented-out `factorize` method. - Make `SparseVecOrMat` (used in 32 method signatures) and `SparseOrStructuredMatrix` in `higherorderfns.jl` `const`, like their neighbours. - Remove unused imports: `StridedMaybeAdjOrTransMat`, `SorF`, `diagm`. Move `isbanded` from `import` to `using`, since it is called but never extended. No behaviour change; full test suite passes and no new ambiguities. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LgBHUw9Hp7YW5ub29B4R5y
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #779 +/- ##
==========================================
+ Coverage 84.19% 84.20% +0.01%
==========================================
Files 13 13
Lines 9403 9403
==========================================
+ Hits 7917 7918 +1
+ Misses 1486 1485 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Cleanup from a structural review of
src/linalg.jlandsrc/higherorderfns.jl. No behaviour change.Name shadows. These are the same class of bug as #769 (
findprevdefined locally instead of extendingBase), just with internal names:src/linalg.jldefined an unqualified_generic_matmatmul!, which creates a SparseArrays-local function, while the same file callsLinearAlgebra._generic_matmatmul!(qualified) for dense destinations. Two different functions with one name, 350 lines apart. The local one is renamed_generic_spmatmatmul!with a comment explaining the relationship._mul!used by the symmetric/Hermitian path (now_symherm_mul!) versus the extension ofLinearAlgebra._mul!at the top of the file.top_set_bitshim shadowedBase.top_set_bit; dropped in favour of callingBase.top_set_bitdirectly (the package requires Julia 1.11).const DenseVecOrMatshadowed the exportedBase.DenseVecOrMatwith a different meaning, and was unused.Dead code.
DenseTriangular,SpBroadcasted2, and a nine-line commented-outfactorizemethod, all with zero references.Missing
const.SparseVecOrMat(used in 32 method signatures) andSparseOrStructuredMatrixinhigherorderfns.jlwere plain globals, unlike the five aliases next to them.Imports. Removed
StridedMaybeAdjOrTransMat,SorF, anddiagm, none of which are referenced.isbandedis called but never extended, and it is not exported by LinearAlgebra, so it moves fromimporttousing.Full test suite passes on nightly;
Test.detect_ambiguities(SparseArrays)remains empty; whitespace check clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01LgBHUw9Hp7YW5ub29B4R5y