Eunit timeout in receive results in wrong location in stack trace

I’ve got some eunit code that looks a bit like this:

    % ...
    meck:wait(m, f, '_', 2000),    % L1
    receive                        % L2
        message1 -> ok
    end,
    receive                        % L3
        message2 -> ok
    end
    % ...

message2 is never sent, so the receive at L3 never completes, so eunit kills my test with a timeout. This is expected.

But: the location reported is L1, rather than the expected L3. It looks like receive expressions don’t appear in stack traces.

It’s probably not relevant that I’m using meck – if I add some code in between the two receive expressions, the reported location is that of the added code.

This is with Erlang/OTP 26.2.5.3.

It appears the the added code needs to make a proper function call. If I use a throwaway atom or an inline anonymous function – ((fun() -> ok end)()) – then it still reports the wrong location. If I call, say mark(), where mark() -> ignore., then the location is more correct (but still not that of the receive).