FunctionProperties.jl is a package which contains utilities for testing the
properties of Julia functions. For example, do you need to know if f
has
internal branches (if statements) in order to know if a given AD optimization
or symbolic pass is valid? This package's functions allows you to perform
such analyses on functions from a user's code by doing a compiler-based
code inspection.
@test hasbranching(1, 2) do x, y
(x < 0 ? -x : x) + exp(y)
end # true
@test hasbranching(1, 2) do x, y
ifelse(x < 0, -x, x) + exp(y)
end # false