Skip to content

Commit 763d008

Browse files
committed
fix tuple_type_head and tuple_type_tail on UnionAll
1 parent deb0941 commit 763d008

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
@@ -86,13 +86,13 @@ end
8686
argtail(x, rest...) = rest
8787
tail(x::Tuple) = argtail(x...)
8888

89-
tuple_type_head(T::UnionAll) = tuple_type_head(T.body)
89+
tuple_type_head(T::UnionAll) = (@_pure_meta; UnionAll(T.var, tuple_type_head(T.body)))
9090
function tuple_type_head(T::DataType)
9191
@_pure_meta
9292
T.name === Tuple.name || throw(MethodError(tuple_type_head, (T,)))
9393
return unwrapva(T.parameters[1])
9494
end
95-
tuple_type_tail(T::UnionAll) = tuple_type_tail(T.body)
95+
tuple_type_tail(T::UnionAll) = (@_pure_meta; UnionAll(T.var, tuple_type_tail(T.body)))
9696
function tuple_type_tail(T::DataType)
9797
@_pure_meta
9898
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
@@ -291,3 +291,7 @@ let
291291

292292
test_15703()
293293
end
294+
295+
# https://github.com/JuliaLang/julia/issues/21026#issuecomment-317113307
296+
const VecTuple21026{T} = Tuple{VecElement{T}}
297+
@test convert(VecTuple21026, (1,)) === (VecElement(1),)

0 commit comments

Comments
 (0)