Named tuple parsing bug on master?

julia> using LightQuery

julia> test(x) = transform(x, b = 1.0)
test (generic function with 1 method)

julia> test((a = 1,))
(a = 1, b = 1.0)

julia> transform((a = 1,), b = 1.0)
ERROR: MethodError: no method matching merge(::Tuple{Int64}, ::NamedTuple{(:b,),Tuple{Float64}})
Closest candidates are:
  merge(::Missing, ::NamedTuple) at C:\Users\hp\.julia\dev\LightQuery\src\columns.jl:190
  merge(::NamedTuple{(),T} where T<:Tuple, ::NamedTuple) at namedtuple.jl:228
  merge(::NamedTuple{an,T} where T<:Tuple, ::NamedTuple{bn,T} where T<:Tuple) where {an, bn} at namedtuple.jl:216
  ...
Stacktrace:
 [1] #transform#4(::Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol},NamedTuple{(:b,),Tuple{Float64}}}, ::typeof(transform), ::Tuple{Int64}) at .\REPL[13]:1
 [2] (::getfield(LightQuery, Symbol("#kw##transform")))(::NamedTuple{(:b,),Tuple{Float64}}, ::typeof(transform), ::Tuple{Int64}) at .\none:0
 [3] top-level scope at REPL[39]:100:

What’s going on?

Can you give an MWE (no LightQuery)?

1 Like

transform(it; assignments...) = merge(it, assignments)

In the example assignments is not a NamedTuple but a pair iterator. You should do merge(it, values(assignments)), I think.

This looks odd:

julia> transform(it; assignments...) = @show it
transform (generic function with 1 method)

julia> transform((a = 1,));
it = (a = 1,)

julia> transform((a = 1,), b = 1.0);
it = (1,)

Open an issue please.

1 Like

tried that didn’t help

2 Likes

ups you are right, definitely something funny going on.