• Ben Gamari's avatar
    Model divergence of retry# as ThrowsExn, not Diverges · 10a1a478
    Ben Gamari authored
    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 #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.
    
    Updates stm submodule for tests.
    
    Test Plan: Validate with T14171
    
    Reviewers: simonpj, austin
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #14171, #8091
    
    Differential Revision: https://phabricator.haskell.org/D3919
    10a1a478
Demand.hs 78.8 KB