I was recently debugging a test that accidentally patched the wrong function. (The mocked function was the patched function's callee.)
Instead of getting an error, as I'd expect, to protect the programmer from the mistake the test silently passed, even though actually the test would have been broken if the patch was on the correct function. This is quite bad, and should be fixed.
Here is a simple example. I would expect this to throw an error on the @patch call, rather than proceeding:
julia> foo() = 10
foo (generic function with 1 method)
julia> apply(@patch foo() = 3) do
@show foo()
end
foo() = 10
10
Thank you!