Thanks, @anon94023334. What’s good about @test @inferred(f(1,2,3)) == 1 is that it shows up as a unit test and doesn’t abort the testset when inference fails. But failure of inference shows up as “Error During Test” rather than “Test Failed”. You also have to check for the return value (which may be a good or a bad thing; bad if the return value is too complicated or random).
In julia/test out of the 124 times @inferred is used, it is only in 35 cases that it is used in combination with @test:
C:\Users\andras\git\julia\test>grep "@test.*@inferred " *.jl */*.jl | wc
35 295 2812
C:\Users\andras\git\julia\test>grep "@inferred " *.jl */*.jl | wc
124 714 7413
Some of the @inferreds without @test are using random numbers, they probably couldn’t be rewritten with the @test (@inferred f(1,2,3))==1 trick. Others probably could (should?) be rewritten that way.
I’ll open a PR adding @isinferred once I have enough time.