Model divergence of retry# as ThrowsExn, not Diverges
ClosedPublic

Authored by bgamari on Sep 2 2017, 7:30 PM.

Details

Summary

The demand signature of the retry# primop previously had a Diverges result.
However, this caused the demand analyser to conclude that a program of the
shape,

catchRetry# (... >> retry#)

would diverge. Of course, this is plainly wrong; catchRetry#'s sole reason to
exist is to "catch" the "exception" thrown by retry#. While catchRetry#'s demand
signature correctly had the ExnStr flag set on its first argument, indicating
that it should catch divergence, the logic associated with this flag doesn't
apply to Diverges results. This resulted in Trac #14171.

The solution here is to treat the divergence of retry# as an exception. Namely,
give it a result type of ThrowsExn rather than Diverges.

Test Plan

Validate with T14171

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari created this revision.Sep 2 2017, 7:30 PM
bgamari updated the Trac tickets for this revision.Sep 2 2017, 7:31 PM
This revision was automatically updated to reflect the committed changes.