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

Version check workaround for JuliaLang/julia#29970 #47

Merged
merged 1 commit into from
Mar 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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