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

Error with vararg in @gg #38

Open
baggepinnen opened this issue Jan 27, 2020 · 1 comment
Open

Error with vararg in @gg #38

baggepinnen opened this issue Jan 27, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@baggepinnen
Copy link

If a generalized generated function has a vararg input the following error occurs

@gg function f(x...)
    quote
        x
    end
end

julia> f(1,2,3)
ERROR: MethodError: Cannot `convert` an object of type Expr to an object of type Symbol
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:168
  Symbol(::Any...) at strings/basic.jl:206
Stacktrace:
 [1] GeneralizedGenerated.NGG.Argument(::Expr, ::Nothing, ::GeneralizedGenerated.NGG.Unset) at /home/fredrikb/.julia/packages/GeneralizedGenerated/EBwdX/src/ngg/runtime_fns.jl:19
 [2] of_args(::Array{GeneralizedGenerated.FuncArg,1}) at /home/fredrikb/.julia/packages/GeneralizedGenerated/EBwdX/src/func_arg_decs.jl:62
 [3] ##GeneralizedGenerated 245#737#61 at /home/fredrikb/.julia/packages/GeneralizedGenerated/EBwdX/src/closure_conv.jl:45 [inlined]
 [4] ##GeneralizedGenerated 243#735#60 at ./none:0 [inlined]
 [5] ##GeneralizedGenerated 236#728#59 at ./none:0 [inlined]
 [6] ##GeneralizedGenerated 234#726#58 at ./none:0 [inlined]
 [7] (::GeneralizedGenerated.var"#conv#55"{Module})(::Expr) at /home/fredrikb/.julia/packages/GeneralizedGenerated/EBwdX/src/closure_conv.jl:27
 [8] closure_conv(::Module, ::Expr) at /home/fredrikb/.julia/packages/GeneralizedGenerated/EBwdX/src/closure_conv.jl:78
 [9] #s34#362(::Any, ::Any) at /home/fredrikb/.julia/packages/GeneralizedGenerated/EBwdX/src/closure_conv.jl:121
 [10] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:524
 [11] top-level scope at none:0
@thautwarm
Copy link
Member

thautwarm commented Jan 27, 2020

Hello, thanks for this issue. Support for vararg is possible, but it's not a one-line bugfix.
I promise to support this in the next release, and during this period, I suggest you to use this workaround:

f(x...) = _f(x)
@gg _f(x) = ...

@thautwarm thautwarm added the enhancement New feature or request label Jan 28, 2020
thautwarm added a commit that referenced this issue Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants