diff options
author | Piyush P Kurur <ppk@cse.iitk.ac.in> | 2018-08-06 18:37:56 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-08-06 18:38:55 -0400 |
commit | 7d771987c2766bfedc92f5183d6fd571ab508a0e (patch) | |
tree | 6e613fc7809f30c8632c618bc5ceed7a5f748be1 /testsuite/tests/backpack | |
parent | e28bb01d707aee462eae07c5a30a596b2830579f (diff) | |
download | haskell-7d771987c2766bfedc92f5183d6fd571ab508a0e.tar.gz |
Support typechecking of type literals in backpack
Backpack is unable to type check signatures that expect a data which
is a type level literal. This was reported in issue #15138. These
commits are a fix for this. It also includes a minimal test case that
was mentioned in the issue.
Reviewers: bgamari, ezyang, goldfire
Reviewed By: bgamari, ezyang
Subscribers: simonpj, ezyang, rwbarton, thomie, carter
GHC Trac Issues: #15138
Differential Revision: https://phabricator.haskell.org/D4951
Diffstat (limited to 'testsuite/tests/backpack')
-rw-r--r-- | testsuite/tests/backpack/should_run/T15138.bkp | 36 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_run/T15138.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_run/all.T | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/should_run/T15138.bkp b/testsuite/tests/backpack/should_run/T15138.bkp new file mode 100644 index 0000000000..7cb9eeb804 --- /dev/null +++ b/testsuite/tests/backpack/should_run/T15138.bkp @@ -0,0 +1,36 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE FlexibleContexts #-} + +unit indef where + + signature Abstract where + import GHC.TypeLits + data NatType :: Nat + + module Util where + import Abstract + import Data.Proxy + import GHC.TypeLits + + natTypeToInteger :: KnownNat NatType => Proxy NatType -> Integer + natTypeToInteger = natVal + +unit concrete where + module Concrete where + type NatType = 32 + + +unit main where + dependency indef[Abstract=concrete:Concrete] (Util as MyUtil) + + module Main where + import Data.Proxy + import MyUtil + + main :: IO () + main = do print $ natTypeToInteger Proxy diff --git a/testsuite/tests/backpack/should_run/T15138.stdout b/testsuite/tests/backpack/should_run/T15138.stdout new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/testsuite/tests/backpack/should_run/T15138.stdout @@ -0,0 +1 @@ +32 diff --git a/testsuite/tests/backpack/should_run/all.T b/testsuite/tests/backpack/should_run/all.T index 48ed0c6310..61277b8f31 100644 --- a/testsuite/tests/backpack/should_run/all.T +++ b/testsuite/tests/backpack/should_run/all.T @@ -8,3 +8,4 @@ test('bkprun07', normal, backpack_run, ['']) test('bkprun08', normal, backpack_run, ['']) test('bkprun09', normal, backpack_run, ['-O']) test('T13955', normal, backpack_run, ['']) +test('T15138', normal, backpack_run, ['']) |