proc E_to_γ(E: GeV): UnitLess =
result = E.to(Joule) / (m_μ * c * c) + 1
echo 5.eV.E_to_γ()
Instead of throwing an error, it compiles and runs just fine. The argument instead of 5.eV is instead 1.GeV! To make matters worse, the result of the procedure called (which is computed correctly given a wrong value of 1.GeV) is not returned. Instead 5 is returned as a value of the expression (without any kind of unit).
It works perfectly fine using regular call syntax E_to_γ(5.eV), throws a CT error.
Is this an upstream bug or a bizarre side effect + bug of our macros?
The following code should CT error:
Instead of throwing an error, it compiles and runs just fine. The argument instead of
5.eV
is instead1.GeV
! To make matters worse, the result of the procedure called (which is computed correctly given a wrong value of1.GeV
) is not returned. Instead5
is returned as a value of the expression (without any kind of unit).It works perfectly fine using regular call syntax
E_to_γ(5.eV)
, throws a CT error.Is this an upstream bug or a bizarre side effect + bug of our macros?