Preserve tick ordering in 'tickTickedExpr'

Ticket: #27749 (closed).

This fixes a regression introduced in 2dadf3b0 in which source nodes were incorrectly moved past eachother.

Specifically, GHC.Core.Utils.tickTickedExpr tries to combine a tick t1 into an existing stack of ticks t2s. There are two situations:

  1. t1 is subsumed by a tick in t2s: drop it.
  2. A tick in t2s is subsumed by t1, say t2.

This MR ensures that in case (2) we keep t1 on the outside instead of replacing t2 at its position in the stack. This avoids re-ordering source notes (which was the cause of #27749 (closed)).

Merge request reports

Loading