Anything that breaks across Julia versions is a bug, so please report it (with reproducer) as an issue in SnoopCompile.
Obviously generated functions don’t help, since both the generated function and the function that is generated need to get compiled.
If you have essentially limitless type combinations, yes, it’s hopeless. But in limited cases it should work. Demo:
julia> @generated function mygen(x::T) where T
Tbigger = T == Float32 ? Float64 : BigFloat
:(convert($Tbigger, x))
end
mygen (generic function with 1 method)
julia> using SnoopCompile
julia> tinf = @snoopi begin
mygen(1.0f0)
mygen(1.0)
end
3-element Array{Tuple{Float64,Core.MethodInstance},1}:
(0.00042700767517089844, MethodInstance for #s1#3(::Any, ::Any, ::Any))
(0.0005278587341308594, MethodInstance for mygen(::Float64))
(0.003690004348754883, MethodInstance for mygen(::Float32))
That #s1#3
is the generator for mygen
.