Commit f0212a93 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

TcInteract: Ensure that tycons have representations before solving for Typeable

Summary: This fixes #15067.

Test Plan: Validate

Subscribers: thomie, carter, RyanGlScott

GHC Trac Issues: #15067

Differential Revision: https://phabricator.haskell.org/D4623
parent 9039f847
......@@ -25,6 +25,7 @@ dataConInstOrigArgTys :: DataCon -> [Type] -> [Type]
dataConStupidTheta :: DataCon -> ThetaType
dataConFullSig :: DataCon
-> ([TyVar], [TyVar], [EqSpec], ThetaType, [Type], Type)
isUnboxedSumCon :: DataCon -> Bool
instance Eq DataCon
instance Uniquable DataCon
......
......@@ -2698,9 +2698,12 @@ doFunTy clas ty arg_ty ret_ty
-- of monomorphic kind (e.g. all kind variables have been instantiated).
doTyConApp :: Class -> Type -> TyCon -> [Kind] -> TcS LookupInstResult
doTyConApp clas ty tc kind_args
| Just _ <- tyConRepName_maybe tc
= return $ GenInst (map (mk_typeable_pred clas) kind_args)
(\kinds -> evTypeable ty $ EvTypeableTyCon tc (map EvExpr kinds))
True
| otherwise
= return NoInstance
-- | Representation for TyCon applications of a concrete kind. We just use the
-- kind itself, but first we must make sure that we've instantiated all kind-
......
......@@ -155,6 +155,7 @@ import Util
import Unique( tyConRepNameUnique, dataConRepNameUnique )
import UniqSet
import Module
import {-# SOURCE #-} DataCon
import qualified Data.Data as Data
......@@ -1190,7 +1191,10 @@ tyConRepName_maybe (AlgTyCon { algTcParent = parent })
| UnboxedAlgTyCon rep_nm <- parent = rep_nm
tyConRepName_maybe (FamilyTyCon { famTcFlav = DataFamilyTyCon rep_nm })
= Just rep_nm
tyConRepName_maybe (PromotedDataCon { tcRepName = rep_nm })
tyConRepName_maybe (PromotedDataCon { dataCon = dc, tcRepName = rep_nm })
| isUnboxedSumCon dc -- see #13276
= Nothing
| otherwise
= Just rep_nm
tyConRepName_maybe _ = Nothing
......
{-# LANGUAGE UnboxedSums #-}
{-# LANGUAGE DataKinds #-}
module T15067 where
import Type.Reflection
floopadoop :: TypeRep (# Bool | Int #)
floopadoop = typeRep
rubadub :: (# True | 4 #)
rubadub = typeRep
T15067.hs:7:14:
T15067.hs:9:14:
No instance for (Typeable (# 'GHC.Types.LiftedRep #))
arising from a use of ‘typeRep’
GHC can't yet do polykinded
......
......@@ -473,4 +473,4 @@ test('T14761b', normal, compile_fail, [''])
test('T14884', normal, compile_fail, [''])
test('T14904a', normal, compile_fail, [''])
test('T14904b', normal, compile_fail, [''])
test('T15067', expect_broken(15067), compile_fail, [''])
test('T15067', normal, compile_fail, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment