Skip to content

Commit

Permalink
Version check workaround for JuliaLang/julia#29970
Browse files Browse the repository at this point in the history
The workaround for JuliaLang/julia#29970 causes newer versions of Julia
to hang in the precompilation step for TypedTables.

Since JuliaLang/julia#29970 has been addressed in JuliaLang/julia#30577
the code is avoided in newer versions of Julia.
  • Loading branch information
lcw committed Mar 19, 2019
1 parent 5142f30 commit be8224b
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/TypedTables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@ end
_ndims(a::NamedTuple{<:Any, T}) where {T} = _ndims(T)
_ndims(::Type{<:Tuple{Vararg{AbstractArray{<:Any, n}}}}) where {n} = n

# Workaround for JuliaLang/julia#29970
let
for n in 1:32
Ts = [Symbol("T$i") for i in 1:n]
xs = [:(x[$i]) for i in 1:n]
NT = :(Core.NamedTuple{names, Tuple{$(Ts...)}})
eval(quote
$NT(x::Tuple{$(Ts...)}) where {names, $(Ts...)} = $(Expr(:new, NT, xs...))
end)
# The following code causes newer versions of Julia to hang in precompilation
# and the workaround should not be needed after JuliaLang/julia#30577 was
# merged.
if VERSION < v"1.2.0-DEV.291"
# Workaround for JuliaLang/julia#29970
let
for n in 1:32
Ts = [Symbol("T$i") for i in 1:n]
xs = [:(x[$i]) for i in 1:n]
NT = :(Core.NamedTuple{names, Tuple{$(Ts...)}})
eval(quote
$NT(x::Tuple{$(Ts...)}) where {names, $(Ts...)} = $(Expr(:new, NT, xs...))
end)
end
end
end

Expand Down

0 comments on commit be8224b

Please sign in to comment.