Fix methods that referred to names that no longer exist - #694
Merged
Conversation
A JET pass over the package turned up a number of methods that could not have been called since Julia 1.0, as they referred to variables or functions that are not defined. Most are typos, and are repaired here; two methods that cannot work at all are removed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.
A JET pass over the package surfaced a set of methods that could not have been called since Julia 1.0 — they refer to variables or functions that are not defined, so they throw
UndefVarError/MethodErroron the first line that touches them. Most are typos and are repaired; two methods are removed.Repaired
LinearAlgebra/lyap.jl:74schurfactandAC[:left]/AC[:S]— the pre-1.0 Schur APIschur,.Q/.Z/.S/.TDomains/Point.jl:2newused outside a struct bodyPoint{T}(T(NaN)), matchingconvert(::Type{Point{T}}, ::AnyDomain)on the next lineDomains/ProductDomain.jl:34pushappendpts!(ret, SVector(x), pts)withxundefinedpushappendpts!(ret, (), pts); the accumulator is a tuple, as incheckpointsabove itPDE/KroneckerOperator.jl:259sp.c— nosp, andConstantTimesOperator's field isλS.λOperators/SubOperator.jl:337,349"Cannot convert $V to a $TYP"— inside@eval,$TYPin a string literal is a runtime reference to a globalTYP$($TYP)Operators/almostbanded/LowRankOperator.jl:30eltype(eltype(v)); the parameter isVeltype(eltype(V))Spaces/Spaces.jl:110BBused on the right-hand side of its own definitionds = domainspace(A[end])first (all ofAshares a domain space afterpromotedomainspace)Spaces/Spaces.jl:113VectorSpace(...)—VectorSpaceis a type alias, not a constructorSpace(::AbstractArray), asLowRankOperator(_, VectorSpace)already doesCaching/blockbanded.jl:47diagblockshift(flatten((v, w), b))—flattenis undefined andbis inside the wrong calldiagblockshift(Vcat(v, w), b), matching the neighbouring branchesSpaces/ConstantSpace.jl:81-82zero(ConstantSpace())— there is nozero(::ConstantSpace)zeros(ConstantSpace())Spaces/ConstantSpace.jl:106,108promote_opinsideBase.promote_opdefinitionsBase.promote_opSpaces/ConstantSpace.jl:9_first_or_zero(f)withf::Fun; the method takes anAbstractVectorf[1], which already handles the empty casespecialfunctions.jl:87minabs, removed in Julia 1.0minimum(abs, f)Removed
isapprox_atol(::Number, ::Number, ::Real)andisapprox_atol(::AbstractArray, ::AbstractArray, ::Real)inLinearAlgebra/helper.jl. Both defaults are dead:Base.rtoldefault(x, y)(two-argument form, removed in 0.7) andvecnorm(removed in 1.0). They were a fast path around the genericisapprox_atol(a, b, atol; kwds...)on the line above, which handles both cases correctly, so removing them leaves every working call unchanged.SubSpace(sp::SubSpace, kr)inSpaces/SubSpace.jl. It callsto_indexes(removed from Base) and a three-argumentreindexthat no longer exists. Nesting now goes through the genericSubSpace(sp::Space, kr).Verified
Each repaired method was exercised in a REPL:
isapprox_atolonNumber/AbstractArray/SVectorlyap(A,B,C,D,E)— residual‖A X Bᵀ + C X Dᵀ − E‖/‖E‖ ≈ 6e-16on a random systemPoint{Float64}(AnyDomain()),zeros(AnyDomain()),zero(UnsetSpace())points((-1.0..1.0)^2, (3,3))→ 9 pointsBase.promote_op(*, typeof(Fun(1.0)), typeof(Fun(x->x, Chebyshev())))Fun(SequenceSpace(), [3.0,4.0])[CartesianIndex()]isfinite(Fun(x->x^2, Chebyshev()))transpose(2.0*Derivative(Chebyshev()))Matrix(::SubOperator)error messageLowRankOperator(U, V)with mixed element typesconvert(Operator, Operator[Evaluation(Chebyshev(),-1), Derivative(Chebyshev())])— this reachesLowRankPertOperator, and now returns a working operatordiagblockshift(Vcat([3,1,1], Ones{Int}(∞)), Ones{Int}(∞))test/runtests.jlgains a testset covering the cases that need onlyApproxFunBase(11 assertions).Pkg.test("ApproxFunBase")passes, and so does downstreamPkg.test("ApproxFun")(1048 pass, 2 broken, 0 fail).Still broken, flagged rather than fixed
Base.real/Base.imagfor aProductFunover a complex basis (Multivariate/ProductFun.jl:414-416) referred to an undefinedu; that is a typo forfand is corrected here. The methods still do not work, though: they buildProductFun(real(f.coefficients), space(f)), which pairs real coefficientFuns (CosSpace ⊕ SinSpace) with the original complex space (Laurent ⊗ Laurent) and throws anInexactError. Making them work needs more than a rename, so they are left as a known gap — happy to remove them instead if you would rather not keep a non-functional method.🤖 Generated with Claude Code