Skip to content

OccurAnal is stricter on tail call contexts than CoreLint

In CoreLint, I see

       markAllJoinsBadIf block_joins $ lintCoreExpr expr
  where
    block_joins = not (tickish `tickishScopesLike` SoftScope)
      -- TODO Consider whether this is the correct rule. It is consistent with
      -- the simplifier's behaviour - cost-centre-scoped ticks become part of
      -- the continuation, and thus they behave like part of an evaluation
      -- context, but soft-scoped and non-scoped ticks simply wrap the result
      -- (see Simplify.simplTick).

whereas in OccurAnal I see

occAnal env (Tick tickish body)
  | SourceNote{} <- tickish
  = ...

  | tickish `tickishScopesLike` SoftScope
  = WithUsageDetails (markAllNonTail usage) (Tick tickish body')

  ...

So CoreLint says every Tick with scope like SoftScope retains tail call context, whereas OccurAnal says it doesn't. Which one is correct?

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