AlgebraicJulia / AlgebraicJulia/CompTime.jl

`@ct_enable` incorrectly handles `Vararg`.

Abierto
#9 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Julia
Estrellas
73
Forks
3
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.