-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcollectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setstypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
Constructing tuples is buggy because of how it depends on Base.tuple_type_tail:
julia> const A = Tuple{Val{T},T,T} where {T}
Tuple{Val{T}, T, T} where T
julia> const t = (Val(Any), 2, 2.0)
(Val{Any}(), 2, 2.0)
julia> const v = [Val(Any), 2, 2.0]
3-element Vector{Any}:
Val{Any}()
2
2.0
julia> A(v)
ERROR: TypeError: in typeassert, expected Tuple{T, T} where T, got a value of type Tuple{Int64, Float64}
Stacktrace:
[1] _totuple
@ ./tuple.jl:474 [inlined]
[2] _totuple
@ ./tuple.jl:473 [inlined]
[3] (Tuple{Val{T}, T, T} where T)(itr::Vector{Any})
@ Base ./tuple.jl:455
[4] top-level scope
@ REPL[4]:1
julia> t isa A
true
julia> versioninfo()
Julia Version 1.11.0-DEV.1451
Commit f117a500ca9 (2024-02-01 15:38 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)xref: #27736 (comment)
Working on a PR that should fix this by constructing tuples without relying on tuple_type_tail.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcollectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setstypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch