[BUG] `Vararg` does not work on recent Julia versions
jakobnissen opened this issue · comments
Describe the bug
A CLI function of the form:
@main foo(xs::Vararg{String}) = foreach(println, xs)
Errors with ERROR: LoadError: TypeError: in <:, expected Type, got Vararg{String}
. See the full stacktrace at the bottom of this post.
Version of the package:
- Julia 1.10-beta3
- Comonicon 1.0.6
This does not happen on earlier Julia versions
To Reproduce
Execute the following script
using Comonicon
@main foo(xs::Vararg{String}) = foreach(println, xs)
This presumably happens because Vararg{String} isa Type
returns false
on Julia 1.7 and later.
Full stack trace:
ERROR: LoadError: TypeError: in <:, expected Type, got Vararg{String}
Stacktrace:
[1] ignore_type(type::Core.TypeofVararg)
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:2
[2] print_cmd(io::IOBuffer, arg::Comonicon.AST.Argument, t::Comonicon.AST.Terminal)
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:95
[3] print_signature
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:179 [inlined]
[4] print_with_brief(f::typeof(Comonicon.AST.print_signature), io::IOContext{IOBuffer}, cmd::Comonicon.AST.Argument, t::Comonicon.AST.Terminal)
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:268
[5] print_sig_brief
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:259 [inlined]
[6] print_body(io::IOContext{IOBuffer}, cmd::Comonicon.AST.LeafCommand, t::Comonicon.AST.Terminal)
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:225
[7] print_cmd(io::IOContext{IOBuffer}, cmd::Comonicon.AST.LeafCommand, t::Comonicon.AST.Terminal)
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:152
[8] print_cmd(io::IOContext{IOBuffer}, cmd::Comonicon.AST.LeafCommand)
@ Comonicon.AST ~/.julia/packages/Comonicon/AXDxW/src/ast/printing.jl:86
[9] _sprint(f::Function, args::Comonicon.AST.LeafCommand; color::Bool, displaysize::Tuple{Int64, Int64})
@ Comonicon ~/.julia/packages/Comonicon/AXDxW/src/compat.jl:10
[10] _sprint
@ Comonicon ~/.julia/packages/Comonicon/AXDxW/src/compat.jl:7 [inlined]
[11] #help_str#1
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:10 [inlined]
[12] help_str
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:9 [inlined]
[13] print_help_str(x::Comonicon.AST.LeafCommand, ctx::Comonicon.JuliaExpr.EmitContext)
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:33
[14] emit_help(x::Comonicon.AST.LeafCommand, ctx::Comonicon.JuliaExpr.EmitContext, ptr::Int64; color::Bool)
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:40
[15] emit_help
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:40 [inlined]
[16] emit_body(cmd::Comonicon.AST.LeafCommand, ctx::Comonicon.JuliaExpr.EmitContext, ptr::Int64)
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:150
[17] emit_body(cmd::Comonicon.AST.NodeCommand, ctx::Comonicon.JuliaExpr.EmitContext, ptr::Int64)
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:133
[18] emit(cmd::Comonicon.AST.Entry, configs::Comonicon.JuliaExpr.Configs, ptr::Int64)
@ Comonicon.JuliaExpr ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:86
[19] top-level scope
@ ~/.julia/packages/Comonicon/AXDxW/src/frontend/cast.jl:449
[20] include
@ Base ./Base.jl:489 [inlined]
[21] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base ./loading.jl:2216
[22] top-level scope
@ stdin:3