I am struggling to understand the type instability of
function foo(x,y,z,r)
r_prime = Point3D(x,y,z)
result = r - rprime
end
given as input
x = 0.; y = 0.; z = 0.;
r = Point3D(1.,1.,1.)
@code_warntype foo(x,y,z,r)
The output I obtain is
MethodInstance for foo(::Float64, ::Float64, ::Float64, ::SVector{3, Float64})
from foo(x, y, z, r::SVector{3, Float64}) in Main at In[78]:1
Arguments
#self#::Core.Const(foo)
x::Float64
y::Float64
z::Float64
r::SVector{3, Float64}
Locals
result::Any
r_prime::SVector{3, Float64}
Body::Any
1 ─ (r_prime = Main.Point3D(x, y, z))
│ %2 = (r - Main.rprime)::Any
│ (result = %2)
└── return %2
Help is much appreciated.