Skip to content

PatError test not actually testing patError #2791

Open
@christiaanb

Description

@christiaanb

First discovered by @leonschoorl in the GHC 9.10 upgrade PR: #2758 (comment)

it turns out that every since the GHC 9.2 series, the PatError tests is desugared to:

topEntity
  = \ (ds_d1di :: Maybe Int) ->
      case ds_d1di of {
        __DEFAULT ->
          case GHC.Internal.Control.Exception.Base.patError
                 @GHC.Types.LiftedRep   
                 @()
                 "tests/shouldwork/Basic/PatError.hs:6:1-22|function topEntity"#
          of {};
        Just x_a1cs -> x_a1cs
      }

which Clash's GHC2Core process turns into:

λ(ds :: GHC.Internal.Maybe.Maybe GHC.Types.Int) ->
case ds[LocalId] of
  GHC.Internal.Maybe.Nothing  ->
    Clash.Normalize.Primitives.undefined @GHC.Types.Int
  GHC.Internal.Maybe.Just (x :: GHC.Types.Int) ->
    x[LocalId]

Which means that the test actually no longer tests whether we can deal with patError in the intended way.

We should probably change the GHC2Core process so that it preserves "bottoming" primitives when converting empty case statements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions