Skip to content

Maybe BufSpan field in RealSrcSpan is not strict enough

SrcSpan is defined as follows:

data SrcSpan =                                                                  
     RealSrcSpan !RealSrcSpan !(Maybe BufSpan)  -- See Note [Why Maybe BufPos]   
   | UnhelpfulSpan !UnhelpfulSpanReason

There is a bang pattern on the Maybe BufSpan field, which probably doesn't do what the author anticipated because Maybe has a lazy field. The consequence of this is an accumulation of thunks due to combineSrcSpans not forcing combineBufSpans which also leads to all BufSpans to be retained after being combined.

Solution: Force the result of combineBufSpans in combineSrcSpans.

(This was observed using !3469 (merged))

cc @int-index

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information