diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-04-18 13:26:07 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-04-23 11:39:24 -0400 |
commit | cd8409c26d4370bf2cdcd76801974e99a9adf7b0 (patch) | |
tree | 6f56dc4e4780218d4f5b310d5ca78957b0e448ef /testsuite | |
parent | 8ea37b01b6ab16937f7b528b6bbae9fade9f1361 (diff) | |
download | haskell-cd8409c26d4370bf2cdcd76801974e99a9adf7b0.tar.gz |
Create di_scoped_tvs for associated data family instances properly
See `Note [Associated data family instances and di_scoped_tvs]` in
`GHC.Tc.TyCl.Instance`, which explains all of the moving parts.
Fixes #18055.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/deriving/should_compile/T18055.hs | 41 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/all.T | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_compile/T18055.hs b/testsuite/tests/deriving/should_compile/T18055.hs new file mode 100644 index 0000000000..35f3750840 --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T18055.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeFamilies #-} +module Bug where + +import Data.Kind + +----- + +data Block m = Block + +class NoThunks m where + +newtype AllowThunk a = AllowThunk a + +class GetHeader blk where + data family Header blk :: Type + +instance GetHeader (Block m) where + newtype Header (Block m) = BlockHeader { main :: Header m } + deriving NoThunks via AllowThunk (Header (Block m)) + +----- + +class C a where + data D a + +class X a b + +instance C (Maybe a) where + data D (Maybe a) deriving (X a) + +instance C [a] where + newtype D [a] = MkDList Bool + +newtype MyList a = MkMyList [a] + +instance C (MyList a) where + newtype D (MyList a) = MkDMyList Bool + deriving (X a) via D [a] diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index a00617b057..8a363e72f9 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -123,3 +123,4 @@ test('T17324', normal, compile, ['']) test('T17339', normal, compile, ['-ddump-simpl -dsuppress-idinfo -dno-typeable-binds']) test('T17880', normal, compile, ['']) +test('T18055', normal, compile, ['']) |