Do you know about the code_warntype macro and function?
Test.@inferred is not quite what is needed:
function foo(x)
s = 0
# better use a zero of the same type than x
# s = zero(x)
for y in x
s += y
end
return s
end
Test.@inferred Float64 foo(12.1)
This test succeeds even if code is type-unstable