Skip to content

type stability: (::Polynomial)(::ImmutablePolynomial) composition yields ImmutablePolynomial #520

@nsajko

Description

@nsajko

With v4.0.0:

julia> using Test, Polynomials

julia> p = ImmutablePolynomial((1,))
ImmutablePolynomial(1)

julia> q = Polynomial([10, 20])
Polynomial(10 + 20*x)

julia> @inferred q(p)
ERROR: return type Polynomials.ImmutableDensePolynomial{Polynomials.StandardBasis, Int64, :x, 1} does not match inferred return type Any

It doesn't make sense for this composition to return an ImmutableDensePolynomial, because that makes type stability impossible, because the degree of q is not available in the type domain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions