New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackOverflow in typeintersect when using Tuple type parameters #26487

Open
daanhb opened this Issue Mar 16, 2018 · 1 comment

Comments

2 participants
@daanhb
Contributor

daanhb commented Mar 16, 2018

I'm making a new issue for an older issue (#22239) that was partially fixed. The problem is a StackOverflow error in the following minimal working example:

bar(::Type{Val{Tuple{Tuple{T},T}}}, ::Val{T}) where {T} = 1
bar(::Type{Val{Tuple{T,Tuple{T}}}}, ::Val{T}) where {T} = 2

The output using the current nightly build is:

ERROR: LoadError: StackOverflowError:
Stacktrace:
 [1] top-level scope
 [2] include at ./boot.jl:306 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1072
 [4] include(::Module, ::String) at ./sysimg.jl:29
 [5] exec_options(::Base.JLOptions) at ./client.jl:327
 [6] _start() at ./client.jl:455
in expression starting at /tmp/mwe.jl:2

As @martinholters pointed out in #22239, the error results from typeintersect as follows:

julia> typeintersect(Tuple{Type{Tuple{T,Val{T}}}, Val{T}} where T, Tuple{Type{Tuple{Val{T},T}}, Val{T}} where T)
ERROR: StackOverflowError:
Stacktrace:
 [1] typeintersect(::Any, ::Any) at ./reflection.jl:469
 [2] top-level scope

Above examples were tested today on master:

julia> versioninfo()
Julia Version 0.7.0-DEV.4594
Commit 29a1719f95 (2018-03-15 22:41 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)
Environment:

The examples do also lead to similar errors on 0.6.2.

@daanhb

This comment has been minimized.

Contributor

daanhb commented Jun 18, 2018

This stack overflow in typeintersect is still an issue on 0.7.0-alpha.0:

julia> typeintersect(Tuple{Type{Tuple{T,Val{T}}}, Val{T}} where T, Tuple{Type{Tuple{Val{T},T}}, Val{T}} where T)
ERROR: StackOverflowError:
Stacktrace:
 [1] typeintersect(::Any, ::Any) at ./reflection.jl:475
 [2] top-level scope
julia> versioninfo()
Julia Version 0.7.0-alpha.0
Commit 22590d529d (2018-05-31 00:07 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)

The original MWE above also still triggers the stack overflow on v0.7.0-alpha.0, with error messages very similar to those of the nightly builds in March.

@JeffBezanson JeffBezanson added the bug label Sep 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment