Skip to content

_limit_type_size failure on Type wrapped Tuples #50681

Open

Description

julia> const AD1 = Array;

julia> B = Tuple{Type{Tuple{AD1{Float64, 1}, AD1{Float64, 1}}}};

julia> A = Tuple{Type{<:Tuple{T, S}}} where {T, S};

julia> D = Tuple{Type{Base.Broadcast.Broadcasted{Base.Broadcast.ArrayStyle{AD1}, Nothing, typeof(+), Tuple{AD1{Float64, 1}, AD1{Float64, 1}}}}};

julia> Core.Compiler.limit_type_size(B, A, D, 0, 0)
Tuple{Type{Tuple{Vector{Float64}, Vector{Float64}}}}

julia> Core.Compiler.type_more_complex(B, A, Core.svec(D), 1, 0, 0)
true

julia> Core.Compiler._limit_type_size(B, A, Core.svec(D), 1, 0)
Tuple{Type{Tuple{Vector{Float64}, Vector{Float64}}}} # oopsie?

This does not satisfy the desirable property of complexity(specTypes) :>= complexity(sig) as it makes inference limiting harder to reason about:

julia> C
Tuple{Type{Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.ArrayStyle{Array}, Nothing, typeof(+), Tuple{Vector{Float64}, Vector{Float64}}}, Base.Broadcast.Broadcasted{Base.Broadcast.ArrayStyle{Array}, Nothing, typeof(+), Tuple{Vector{Float64}, Vector{Float64}}}}}};

julia> Core.Compiler.limit_type_size(B, C, D, 0, 0)
Tuple{Type}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions