Skip to content

Commit fa13e4b

Browse files
JeffBezansonararslan
authored andcommitted
Merge pull request #22911 from JuliaLang/jb/tthttt
fix `tuple_type_head` and `tuple_type_tail` on `UnionAll` Ref #22911 (cherry picked from commit 17496a4)
1 parent c56c23e commit fa13e4b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

base/essentials.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ end
5959
argtail(x, rest...) = rest
6060
tail(x::Tuple) = argtail(x...)
6161

62-
tuple_type_head(T::UnionAll) = tuple_type_head(T.body)
62+
tuple_type_head(T::UnionAll) = (@_pure_meta; UnionAll(T.var, tuple_type_head(T.body)))
6363
function tuple_type_head(T::DataType)
6464
@_pure_meta
6565
T.name === Tuple.name || throw(MethodError(tuple_type_head, (T,)))
6666
return unwrapva(T.parameters[1])
6767
end
68-
tuple_type_tail(T::UnionAll) = tuple_type_tail(T.body)
68+
tuple_type_tail(T::UnionAll) = (@_pure_meta; UnionAll(T.var, tuple_type_tail(T.body)))
6969
function tuple_type_tail(T::DataType)
7070
@_pure_meta
7171
T.name === Tuple.name || throw(MethodError(tuple_type_tail, (T,)))

test/tuple.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,7 @@ end
258258
for n = 0:15
259259
@test ntuple(identity, Val{n}) == ntuple(identity, n)
260260
end
261+
262+
# https://github.com/JuliaLang/julia/issues/21026#issuecomment-317113307
263+
const VecTuple21026{T} = Tuple{VecElement{T}}
264+
@test convert(VecTuple21026, (1,)) === (VecElement(1),)

0 commit comments

Comments
 (0)