julia> VERSION
v"1.11.0-beta1"
julia> using FunctionProperties, Test
julia> @test hasbranching(1, 2) do x, y
(x < 0 ? -x : x) + exp(y)
end
Error During Test at REPL[2]:1
Test threw exception
Expression: hasbranching(1, 2) do x, y
#= REPL[2]:2 =#
if x < 0
-x
else
x
end + exp(y)
end
MethodError: objects of type Int64 are not callable
The object of type `Int64` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Maybe you forgot to use an operator such as *, ^, %, / etc. ?
Stacktrace:
[1] (::var"
@ ./REPL[2]:2 [inlined]
[2] #13
@ ./REPL[2]:2 [inlined]
[3] recurse(::Cassette.Context{FunctionProperties.var"##HasBranchingCtx#Name", Dict{Symbol, Bool}, Nothing, FunctionProperties.var"##PassType#230", Nothing, Cassette.DisableHooks}, ::var"#13#14", ::Int64, ::Int64)
@ Cassette ~/.julia/packages/Cassette/4UsSX/src/overdub.jl:0
[4] overdub(::Cassette.Context{FunctionProperties.var"##HasBranchingCtx#Name", Dict{Symbol, Bool}, Nothing, FunctionProperties.var"##PassType#230", Nothing, Cassette.DisableHooks}, ::Function, ::Int64, ::Int64)
@ FunctionProperties ~/PkgEvalAnalysis/dev/FunctionProperties.jl/src/FunctionProperties.jl:12
[5] hasbranching(::Function, ::Int64, ::Vararg{Int64})
@ FunctionProperties ~/PkgEvalAnalysis/dev/FunctionProperties.jl/src/FunctionProperties.jl:99
[6] macro expansion
@ REPL[2]:1 [inlined]
[7] macro expansion
@ ~/.julia/juliaup/julia-1.11.0-beta1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:676 [inlined]
[8] top-level scope
@ REPL[2]:1
ERROR: There was an error during testing
julia> @test hasbranching(1, 2) do x, y
(x < 0 ? -x : x) + exp(y)
end
Test Passed
julia> @test !hasbranching(1, 2) do x, y
ifelse(x < 0, -x, x) + exp(y)
end
Test Passed