Skip to content

StackOverflowError in type intersection / inference #44395

@goerch

Description

@goerch

Reported on discourse:

using Graphs

abstract type MyAbstract end

struct Composite{T <: MyAbstract,R <: MyAbstract} <: MyAbstract
    a::T
    av::Vector{Union{T,R}}
end

struct Leaf <: MyAbstract
    b
end
Leaf() = Leaf(1)

Composite{T,R}() where {T<:MyAbstract,R<:MyAbstract} = Composite{T,R}(T(),Vector{Union{T,R}}([T()]))

randcomp1(firsttype::Type) = Composite{firsttype, Composite}()

randcomp1(Leaf)

crashes 1.7.2 with

Internal error: encountered unexpected error in runtime:
StackOverflowError()
intersect at /cygdrive/c/buildbot/worker/package_win64/build/src\subtype.c:2960

and seems to work on nightly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    types and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions