view test/test_util.jl @ 760:e7176fb09e98 test/type_stability

Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 02 Jul 2021 14:02:45 +0200
parents
children
line wrap: on
line source

function is_type_stable(f,args...)
    type_stable = true
    try @inferred f(args...)
    catch
        type_stable = false
    end
    return type_stable
end