Why *wouldn't* one want to use @inferred in package tests?

testing

#1

So, I just found out about Base.test.@inferred and this looks like a nice way to ensure that functions are type-stable.

Is there any reason one shouldn’t use @inferred by default in all package tests? (That is, can/should I replace all @test statements with @test @inferred?)


#2

You donn’t use @test @inferred, just @inferred. If you want to make sure everything is inferred, you can, There are many things that aren’t inferrable though.


#3

I do it in a lot of places and it usually looks something like this: https://github.com/JuliaML/LossFunctions.jl/blob/master/test/tst_api.jl#L30-L33. Works like a charm. Note that it seems using parenthesis are important when doing @test @inferred(...) == ....