AlgebraicJulia / AlgebraicJulia/CompTime.jl
`@ct_enable` incorrectly handles `Vararg`.
- Ngôn ngữ chính
- Julia
- Star
- 73
- Fork
- 3
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Here's a MWE:
```julia
julia> @ct_enable function f(x::Vararg{Any, N}) where {N}
N
end
ERROR: TypeError: in TypeVar, in upper bound, expected Type, got Vararg{Any, N}
Stacktrace:
[1] TypeVar(n::Symbol, ub::Any)
@ Core ./boot.jl:254
[2] top-level scope
@ REPL[24]:1
```
and here's what's going wrong:
```julia
julia> @macroexpand1 @ct_enable function f(x::Vararg{Any, N}) where {N}
N
end
quote
#= REPL[25]:1 =#
function f(x::Vararg{Any, N}; ) where N
(CompTime.comptime)(f, x)
end
#= REPL[25]:1 =#
function CompTime.generate_code(::(typeof)(f), ::(Type){<:Vararg{Any, N}}; ) where N # <-------- This is bad
$(Expr(:copyast, :($(QuoteNode(quote
#= REPL[25]:1 =#
#= REPL[25]:2 =#
N
end)))))
end
#= REPL[25]:1 =#
function CompTime.comptime(::(typeof)(f), x::Vararg{Any, N}; ) where N
#= /home/mason/.julia/packages/CompTime/Ppb3B/src/CompTime.jl:137 =#
if $(Expr(:generated))
#= /home/mason/.julia/packages/CompTime/Ppb3B/src/CompTime.jl:138 =#
(CompTime.generate_code)(f, Vararg{Any, N})
else
#= /home/mason/.julia/packages/CompTime/Ppb3B/src/CompTime.jl:140 =#
$(Expr(:meta, :generated_only))
end
end
#= REPL[25]:1 =#
function CompTime.runtime(::(typeof)(f), x::Vararg{Any, N}; ) where N
#= REPL[25]:1 =#
#= REPL[25]:2 =#
N
end
end
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.