Skip to content

Fix methods that referred to names that no longer exist - #694

Merged
jishnub merged 1 commit into
masterfrom
jishnub/dead_code
Aug 24, 2026
Merged

Fix methods that referred to names that no longer exist#694
jishnub merged 1 commit into
masterfrom
jishnub/dead_code

Conversation

@jishnub

@jishnub jishnub commented Aug 24, 2026

Copy link
Copy Markdown
Member

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/MethodError on the first line that touches them. Most are typos and are repaired; two methods are removed.

Repaired

Location Problem Fix
LinearAlgebra/lyap.jl:74 schurfact and AC[:left]/AC[:S] — the pre-1.0 Schur API schur, .Q/.Z/.S/.T
Domains/Point.jl:2 new used outside a struct body Point{T}(T(NaN)), matching convert(::Type{Point{T}}, ::AnyDomain) on the next line
Domains/ProductDomain.jl:34 pushappendpts!(ret, SVector(x), pts) with x undefined pushappendpts!(ret, (), pts); the accumulator is a tuple, as in checkpoints above it
PDE/KroneckerOperator.jl:259 sp.c — no sp, and ConstantTimesOperator's field is λ S.λ
Operators/SubOperator.jl:337,349 "Cannot convert $V to a $TYP" — inside @eval, $TYP in a string literal is a runtime reference to a global TYP $($TYP)
Operators/almostbanded/LowRankOperator.jl:30 eltype(eltype(v)); the parameter is V eltype(eltype(V))
Spaces/Spaces.jl:110 BB used on the right-hand side of its own definition bind ds = domainspace(A[end]) first (all of A shares a domain space after promotedomainspace)
Spaces/Spaces.jl:113 VectorSpace(...)VectorSpace is a type alias, not a constructor build the range space with Space(::AbstractArray), as LowRankOperator(_, VectorSpace) already does
Caching/blockbanded.jl:47 diagblockshift(flatten((v, w), b))flatten is undefined and b is inside the wrong call diagblockshift(Vcat(v, w), b), matching the neighbouring branches
Spaces/ConstantSpace.jl:81-82 zero(ConstantSpace()) — there is no zero(::ConstantSpace) zeros(ConstantSpace())
Spaces/ConstantSpace.jl:106,108 bare promote_op inside Base.promote_op definitions Base.promote_op
Spaces/ConstantSpace.jl:9 _first_or_zero(f) with f::Fun; the method takes an AbstractVector f[1], which already handles the empty case
specialfunctions.jl:87 minabs, removed in Julia 1.0 minimum(abs, f)

Removed

  • isapprox_atol(::Number, ::Number, ::Real) and isapprox_atol(::AbstractArray, ::AbstractArray, ::Real) in LinearAlgebra/helper.jl. Both defaults are dead: Base.rtoldefault(x, y) (two-argument form, removed in 0.7) and vecnorm (removed in 1.0). They were a fast path around the generic isapprox_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) in Spaces/SubSpace.jl. It calls to_indexes (removed from Base) and a three-argument reindex that no longer exists. Nesting now goes through the generic SubSpace(sp::Space, kr).

Verified

Each repaired method was exercised in a REPL:

  • isapprox_atol on Number/AbstractArray/SVector
  • lyap(A,B,C,D,E) — residual ‖A X Bᵀ + C X Dᵀ − E‖/‖E‖ ≈ 6e-16 on a random system
  • Point{Float64}(AnyDomain()), zeros(AnyDomain()), zero(UnsetSpace())
  • points((-1.0..1.0)^2, (3,3)) → 9 points
  • Base.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()))
  • the Matrix(::SubOperator) error message
  • LowRankOperator(U, V) with mixed element types
  • convert(Operator, Operator[Evaluation(Chebyshev(),-1), Derivative(Chebyshev())]) — this reaches LowRankPertOperator, and now returns a working operator
  • diagblockshift(Vcat([3,1,1], Ones{Int}(∞)), Ones{Int}(∞))

test/runtests.jl gains a testset covering the cases that need only ApproxFunBase (11 assertions). Pkg.test("ApproxFunBase") passes, and so does downstream Pkg.test("ApproxFun") (1048 pass, 2 broken, 0 fail).

Still broken, flagged rather than fixed

Base.real/Base.imag for a ProductFun over a complex basis (Multivariate/ProductFun.jl:414-416) referred to an undefined u; that is a typo for f and is corrected here. The methods still do not work, though: they build ProductFun(real(f.coefficients), space(f)), which pairs real coefficient Funs (CosSpace ⊕ SinSpace) with the original complex space (Laurent ⊗ Laurent) and throws an InexactError. 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

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>
@jishnub
jishnub merged commit de5310a into master Aug 24, 2026
20 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.

1 participant