Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce unbound args #442

Merged
merged 1 commit into from
Aug 14, 2022
Merged

Conversation

hyrodium
Copy link
Contributor

This PR reduces the number of methods with unbround args from 13 to 10. I was trying to reduce it to zero by replacing NTuple{N,T} with Tuple{T, Vararg{T, N}} but that breaks tests, so I have not applied the changes.

Before this PR

julia> using Polynomials, Test

julia> detect_unbound_args(Polynomials)
Skipping Polynomials.order
[1] truncate(ps::Tuple{Vararg{T, N}}; rtol, atol) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:288
[2] _norm(a::Tuple{Vararg{T, N}}, p::Real) where {T, N} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/polynomials/ImmutablePolynomial.jl:251
[3] (::Type{<:Polynomials.StandardBasisPolynomial}, p1::Tuple{Vararg{T, N}}, p2::Tuple{Vararg{S, M}}) where {T, N, S, M} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/polynomials/standard-basis.jl:113
[4] var"#truncate#29"(rtol::Real, atol::Real, ::typeof(truncate), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:288
[5] var"#chop#40"(rtol::Real, atol::Real, ::typeof(chop), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:356
[6] (::Base.var"#chop##kw")(::Any, ::typeof(chop), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:356
[7] (::Base.var"#truncate##kw")(::Any, ::typeof(truncate), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:288
[8] (P::Type{<:AbstractPolynomial}, p1::Tuple{Vararg{T, N}}, p2::Tuple{Vararg{S, M}}) where {T, N, S, M} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:888
[9] showterm(io::IO, ::Type{ChebyshevT{T, X}}, pj::T, var, j, first::Bool, mimetype) where {N, T, X} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/polynomials/ChebyshevT.jl:274
[10] scalar_mult(c::S, p::Union{P, R}) where {S<:AbstractPolynomial, T, X, P<:AbstractPolynomial{T, X}, R<:(AbstractPolynomial{T})} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:952
[11] _norm(a::Tuple{Vararg{T, N}}) where {T, N} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/polynomials/ImmutablePolynomial.jl:235
[12] chop(ps::Tuple{Vararg{T, N}}; rtol, atol) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:356
[13] convert(::Type{S}, pq::PQ) where {S<:Number, T, X, P, PQ<:Polynomials.AbstractRationalFunction} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/rational-functions/common.jl:85

julia> detect_ambiguities(Polynomials)
Skipping Polynomials.order
Tuple{Method, Method}[]

After this PR

julia> using Polynomials, Test

julia> detect_unbound_args(Polynomials)
Skipping Polynomials.order
[1] chop(ps::Tuple{Vararg{T, N}}; rtol, atol) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:356
[2] var"#chop#40"(rtol::Real, atol::Real, ::typeof(chop), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:356
[3] (::Type{<:Polynomials.StandardBasisPolynomial}, p1::Tuple{Vararg{T, N}}, p2::Tuple{Vararg{S, M}}) where {T, N, S, M} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/polynomials/standard-basis.jl:113
[4] var"#truncate#29"(rtol::Real, atol::Real, ::typeof(truncate), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:288
[5] _norm(a::Tuple{Vararg{T, N}}, p::Real) where {T, N} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/polynomials/ImmutablePolynomial.jl:251
[6] truncate(ps::Tuple{Vararg{T, N}}; rtol, atol) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:288
[7] _norm(a::Tuple{Vararg{T, N}}) where {T, N} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/polynomials/ImmutablePolynomial.jl:235
[8] (::Base.var"#truncate##kw")(::Any, ::typeof(truncate), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:288
[9] (::Base.var"#chop##kw")(::Any, ::typeof(chop), ps::Tuple{Vararg{T, N}}) where {N, T} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:356
[10] (P::Type{<:AbstractPolynomial}, p1::Tuple{Vararg{T, N}}, p2::Tuple{Vararg{S, M}}) where {T, N, S, M} in Polynomials at /home/hyrodium/.julia/dev/Polynomials/src/common.jl:888

julia> detect_ambiguities(Polynomials)
Skipping Polynomials.order
Tuple{Method, Method}[]

@codecov
Copy link

codecov bot commented Aug 13, 2022

Codecov Report

Merging #442 (7b6e90b) into master (41e026c) will not change coverage.
The diff coverage is 33.33%.

@@           Coverage Diff           @@
##           master     #442   +/-   ##
=======================================
  Coverage   82.84%   82.84%           
=======================================
  Files          23       23           
  Lines        2891     2891           
=======================================
  Hits         2395     2395           
  Misses        496      496           
Impacted Files Coverage Δ
src/common.jl 90.27% <0.00%> (ø)
src/rational-functions/common.jl 71.21% <0.00%> (ø)
src/polynomials/ChebyshevT.jl 96.21% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@hyrodium
Copy link
Contributor Author

The branch name reduce_ambiguities should be reduce_unbound_args.. 😔

@jverzani
Copy link
Member

The branch name reduce_ambiguities should be reduce_unbound_args.. 😔

What do you mean by this? Should I wait to merge this? Thanks again! I wasn't aware of this function.

@hyrodium
Copy link
Contributor Author

I named my branch hyrodium:fix/reduce_ambiguities, but that was my mistake. This is just a branch naming, so merging this PR is fine:smile:

image

@jverzani jverzani merged commit 28febbd into JuliaMath:master Aug 14, 2022
@jverzani
Copy link
Member

Thanks again! That's what I guessed, but wanted to make sure.

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.

None yet

2 participants