diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2020-09-27 22:03:07 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2020-09-27 22:03:45 +0200 |
commit | fc9fd48a8536d78eebcb5fd08c4c14ba7c1b413d (patch) | |
tree | fcb405eea4f62cfbf61e3ff165bcc59acda9f8c7 | |
parent | 8339bc4d413d47482ca3cf7308dc7ed2e78b0b83 (diff) | |
download | haskell-wip/fix-kind-inference.tar.gz |
Linear types: fix kind inference when checking dataconswip/fix-kind-inference
Fixes test MultConstructor.
-rw-r--r-- | compiler/GHC/Tc/TyCl.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/linear/should_compile/MultConstructor.hs | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs index 9cd0b2a66c..9335eb1d58 100644 --- a/compiler/GHC/Tc/TyCl.hs +++ b/compiler/GHC/Tc/TyCl.hs @@ -1569,7 +1569,9 @@ kcTyClDecl (FamDecl _ (FamilyDecl { fdInfo = fd_info })) fam_tc kcConArgTys :: NewOrData -> Kind -> [HsScaled GhcRn (LHsType GhcRn)] -> TcM () kcConArgTys new_or_data res_kind arg_tys = do { let exp_kind = getArgExpKind new_or_data res_kind - ; mapM_ (flip tcCheckLHsType exp_kind . getBangType . hsScaledThing) arg_tys + ; forM_ arg_tys (\(HsScaled mult ty) -> do tcCheckLHsType (getBangType ty) exp_kind + tcMult mult) + -- See Note [Implementation of UnliftedNewtypes], STEP 2 } diff --git a/testsuite/tests/linear/should_compile/MultConstructor.hs b/testsuite/tests/linear/should_compile/MultConstructor.hs index a97eade18e..780c906099 100644 --- a/testsuite/tests/linear/should_compile/MultConstructor.hs +++ b/testsuite/tests/linear/should_compile/MultConstructor.hs @@ -3,7 +3,7 @@ module MultConstructor where import GHC.Types -data T (p :: Multiplicity) a where +data T p a where MkT :: a %p -> T p a {- |