Porting MLKernels.jl to Julia v0.6

I am finishing a PR for fixing MLKernels.jl in Julia v0.6. I got stuck with the following issue. Suppose I have code of the form:

abstract type B{T} end
abstract type C{T} <: B{T} end

struct D1{T} <: B{T} end
struct D2{T} <: B{T} end
struct D3{T} <: C{T} end

tuple = (D1, D2, D3)

println(typeof(tuple))

Tuple{UnionAll,UnionAll,UnionAll}

In Julia v0.6, the tuple is inferred to contain UnionAll (parametric types). MLKernels.jl is looping over a similar tuple to define the behavior of different kernels: https://github.com/trthatcher/MLKernels.jl/blob/master/src/kernel.jl#L354-L411

How to fix that loop so that the list of kernel types is inferred as a list of β€œKernel{T}”? Or alternatively, how to fix the macro itself for Julia v0.6 and beyond?

The code you link to is a top-level loop. Does it matter if it’s inferred correctly or not?

Which macro?

1 Like

Thank you @cstjean, apparently there is another branch dev that already supports Julia v0.6. I closed the PR and will wait for a new release. Thanks for the help anyways.