Skip to content
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

Regression in 1.8.0-rc3 re collection of tuples of types #46074

Closed
mchitre opened this issue Jul 17, 2022 · 2 comments
Closed

Regression in 1.8.0-rc3 re collection of tuples of types #46074

mchitre opened this issue Jul 17, 2022 · 2 comments

Comments

@mchitre
Copy link

mchitre commented Jul 17, 2022

On 1.8.0-rc3, I get the following error:

julia> versioninfo()
Julia Version 1.8.0-rc3
Commit 33f19bcbd25 (2022-07-13 19:10 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.3.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores

julia> abstract type X end

julia> struct Y <: X end

julia>  a = Tuple{Type{<:X}}[]
Tuple{Type{<:X}}[]

julia> push!(a, (Y,))
ERROR: TypeError: in typeassert, expected Tuple{Type{<:X}}, got a value of type Tuple{DataType}
Stacktrace:
 [1] setindex!(A::Vector{Tuple{Type{<:X}}}, x::Tuple{DataType}, i1::Int64)
   @ Base ./array.jl:966
 [2] push!(a::Vector{Tuple{Type{<:X}}}, item::Tuple{DataType})
   @ Base ./array.jl:1059
 [3] top-level scope
   @ REPL[4]:1

for code that used to work fine in 1.7.x (and even in the 1.8.x-beta versions):

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, westmere)

julia> abstract type X end

julia> struct Y <: X end

julia> a = Tuple{Type{<:X}}[]
Tuple{Type{<:X}}[]

julia> push!(a, (Y,))
1-element Vector{Tuple{Type{<:X}}}:
 (Y,)
@jakobnissen
Copy link
Contributor

Is it maybe a bugfix? On Julia 1.7.3 and 1.8-rc2, while it works, we also have

julia> first(a) isa eltype(a)
false

which is certainly confusing, and I'd argue, a bug.

@jakobnissen
Copy link
Contributor

jakobnissen commented Jul 17, 2022

This is a bug that has been fixed. This issue explains it: #44705 . Briefly:

julia> isconcretetype(Type{Y})
false

julia> #= concrete type is... =# typeof((Int,))
Tuple{DataType}

julia> #= therefore =# (Y,) isa Tuple{Type{Y}}
false

julia> #= therefore =# (Y,) isa eltype(a)
false

@vtjnash vtjnash closed this as completed Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants