Skip to content

tuple_tfunc bug handling of Union containing Type{...} #44705

@aviatesk

Description

@aviatesk

I guess this issue should be raised before, but I couldn't find an issue that discusses this.
When working on #44512 (in particularity this issue), I found the following isa check doesn't work as I expected:

julia> Type{Int} <: DataType
true

julia> Int isa Type{Int}
true

julia> (Int,) isa Tuple{DataType} # expected
true

julia> (Int,) isa Tuple{Type{Int}} # I expected this to return `true`
false

So in essence Tuple-type whose parameter contains Type-type doesn't seem to follow the covariant rule.

This issue leads to the ERROR: fatal error in type inference (type bound) error in #44512 when we try to union-split Base.indexed_iterate(::Union{Tuple{Nothing, Nothing, Nothing}, Tuple{Any, Union{Type{AbstractContinuousSystem}, Type{AbstractDiscreteSystem}}, Any}}, ...) callsite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:inferenceType inference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions