Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#12082 closed bug (fixed)

Typeable on RealWorld fails

Reported by: bgamari Owned by:
Priority: high Milestone: 8.0.2
Component: Compiler Version: 8.0.1
Keywords: Typeable Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_run/TypeRep
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D2240, Phab:D2239
Wiki Page:

Description

This,

import GHC.Prim
import Data.Typeable
main = print $ typeRep (Proxy :: Proxy RealWorld)

fails with,

ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.0.20160421 for x86_64-unknown-linux):
	tyConRep RealWorld

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Change History (9)

comment:1 Changed 3 years ago by bgamari

Differential Rev(s): Phab:D2240, Phab:D2239
Milestone: 8.0.2
Priority: normalhigh
Status: newpatch
Test Case: typecheck/should_run/TypeRep

comment:2 Changed 3 years ago by Ben Gamari <ben@…>

In 2e6433a/ghc:

testsuite: Add a TypeRep test

Test Plan: Validate

Reviewers: goldfire, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2239

GHC Trac Issues: #12082, #11120

comment:3 Changed 3 years ago by Ben Gamari <ben@…>

In a88bb1b/ghc:

Give lifted primitive types a representation

As of D1774 everything in GHC.Prim has a representation generated for it
by TcTypeable (see #11120). Unfortunately I evidently missed propagating
this change to lifted primitive types. This patch fixes this (#12082).

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2240

GHC Trac Issues: #12082

comment:4 Changed 3 years ago by bgamari

Status: patchmerge

comment:5 Changed 3 years ago by simonpj

Keywords: Typeable added

comment:6 Changed 3 years ago by acfoltzer

We've somehow managed to run into this without using typeRep directly. Here is a shrink:

{-# LANGUAGE Rank2Types #-}

import Data.Typeable (Typeable)
import Control.Monad.ST (RealWorld)

f :: forall a. (forall b. Typeable b => b -> a) -> a
f = undefined :: (RealWorld -> a) -> a
% ghci Crash.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from ...
[1 of 1] Compiling Main             ( Crash.hs, interpreted )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-apple-darwin):
        tyConRep RealWorld

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

>
Leaving GHCi.

We were able to get around it for our project (it turned out we didn't need to use RealWorld at all) but hopefully this test case helps validate the patch for this issue.

comment:7 Changed 3 years ago by simonpj

Ben: maybe worth adding this as another regression test? It looks a bit different to the original one, and it's small.

Simon

comment:8 Changed 3 years ago by bgamari

Resolution: fixed
Status: mergeclosed

comment:9 Changed 3 years ago by Ben Gamari <ben@…>

In 93acc02f/ghc:

Add another testcase for #12082

Test Plan: Validate, should pass.

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2399

GHC Trac Issues: #12082
Note: See TracTickets for help on using tickets.