Dispatch doesn't work
Opened this issue · 1 comments
MikeInnes commented
We can't define a dynamo just for a subset of methods.
julia> @dynamo function foo(f, x::Real)
IR(f, x)
end
julia> foo(sin, 0.5)
ERROR: Error compiling @dynamo typeof(foo) on (typeof(sin), Float64):
MethodError: no method matching transform(::Type{typeof(foo)}, ::Type{typeof(sin)}, ::Type{Float64})
This is doubly-wrong because (a) the generated function entry point has no type restrictions at all and (b) the transform
inner function does have them, but they need to be lifted to accept an equivalent set of types rather than values (exactly like a generated function).
MikeInnes commented
#42 address the second part of this. The first part is a bit tricky because we currently want the generated function to have a single args...
slot so that the slots in the IR can easily be mapped to that original slot. I'm not sure we can express the right type signature directly there, so we might just have to settle for a more complicated mapping.