Skip to content

Commit aa9bec7

Browse files
authored
don't use Val with ntuple when the length isn't a constant (#525)
Helps type inference. Before: ```julia-repl julia> using Test, JET, Polynomials julia> p = ImmutablePolynomial{Bool, :x, 1}((true,)) ImmutablePolynomial(true) julia> @inferred coeffs(p) ERROR: return type Tuple{Bool} does not match inferred return type Any ``` After: ```julia-repl julia> using Test, JET, Polynomials julia> p = ImmutablePolynomial{Bool, :x, 1}((true,)) ImmutablePolynomial(true) julia> @inferred coeffs(p) ERROR: return type Tuple{Bool} does not match inferred return type Tuple{Vararg{Bool}} ```
1 parent 5f5ba86 commit aa9bec7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/polynomial-container-types/immutable-dense-polynomial.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function trim_trailing_zeros!!(cs::Tuple)
9898
!iszero(last(cs)) && return cs
9999
i = findlast(!iszero, cs)
100100
i == nothing && return ()
101-
xs = ntuple(Base.Fix1(getindex,cs), Val(i))
101+
xs = ntuple(Base.Fix1(getindex,cs), i)
102102
xs
103103
end
104104

@@ -112,7 +112,7 @@ function Base.chop(p::ImmutableDensePolynomial{B,T,X,N};
112112
N′ = 0
113113
else
114114
N′ = i
115-
xs = ntuple(Base.Fix1(getindex, p.coeffs), Val(N′))
115+
xs = ntuple(Base.Fix1(getindex, p.coeffs), N′)
116116
end
117117
ImmutableDensePolynomial{B,T,X,N′}(xs)
118118
end

0 commit comments

Comments
 (0)