2 ms·
Do you know about the code_warntype macro and function?
by leephillips 5y ago
Do you know about the code_warntype macro and function?
- kwertzzz 5y agoThe code_warntype macro is helpful, but to prevent a future inadvertently introduced type stability, a failing test would be much better. 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