Testing typestability

Is there such a thing as @test_code_warntype or something similar that basically just tells me if the return value of the function is “red” or not? What is the current best practice to test this kind of assumption using Base.Test?

@inferred myfunction(myarguments...) will test if the returned type matches the inferred type, as described in the manual.

2 Likes

Ah, thanks! That is exactly what I am looking for. I thought I covered my bases, but I must have looked at the wrong manual version or browsed to hastily. sorry for the noise.

As a follow up question: is there a test method that would throw an error if there a type instability in any part of a method? I’m thinking of methods where the return type is stable, but where some type instability in the middle of the method that might cause a performance problem. Essentially such a method would through if @code_warntype would show something red at any point.

2 Likes