testsuite: Add broken test for #13871
ClosedPublic

Authored by bgamari on Jun 23 2017, 10:00 PM.
bgamari created this revision.Jun 23 2017, 10:00 PM

Thanks, @bgamari. I was originally worried that this patch would make fewer things Typeable in 8.2 than in 8.0, which this program should test:

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Foo where

import Data.Kind
import Data.Typeable

data Foo (a :: Type) (b :: Type) where
  MkFoo :: (a ~ Int, b ~ Char) => Foo a b

data family Sing (a :: k)
data SFoo (z :: Foo a b) where
  SMkFoo :: SFoo MkFoo

f :: String
f = show $ typeOf SMkFoo

But as it turns out, this program fails in both 8.0 and 8.2 (after this patch) with the error:

GHCi, version 8.3.20170624: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Foo              ( Foo.hs, interpreted )

Foo.hs:19:12: error:
    • No instance for (Typeable <>) arising from a use of ‘typeOf’
    • In the second argument of ‘($)’, namely ‘typeOf SMkFoo’
      In the expression: show $ typeOf SMkFoo
      In an equation for ‘f’: f = show $ typeOf SMkFoo
   |
19 | f = show $ typeOf SMkFoo
   |            ^^^^^^^^^^^^^

So that appears to be a separate bug. I've opened Trac #13872 for this.

This revision was automatically updated to reflect the committed changes.