Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PatError test not actually testing patError #2791

Open
christiaanb opened this issue Aug 19, 2024 · 0 comments
Open

PatError test not actually testing patError #2791

christiaanb opened this issue Aug 19, 2024 · 0 comments
Labels

Comments

@christiaanb
Copy link
Member

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant