[Git][ghc/ghc][wip/T18723] WIP: Check for large tuples more thoroughly in the typechecker
Ryan Scott
gitlab at gitlab.haskell.org
Tue Sep 22 00:10:07 UTC 2020
Ryan Scott pushed to branch wip/T18723 at Glasgow Haskell Compiler / GHC
Commits:
8af17561 by Ryan Scott at 2020-09-21T20:07:06-04:00
WIP: Check for large tuples more thoroughly in the typechecker
This unifies the treatment of how GHC checks for constraint tuples
and other tuples by:
* Migrating the `checkTupSize` renamer check to the typechecker,
* Moving the existing `bigConstraintTuple` typechecker validity
check to `checkCTupSize` for consistency with `checkTupSize`, and
* Consistently using `check(C)TupSize` when typechecking tuple
names, expressions, patterns, and types.
Fixes #18723.
- - - - -
24 changed files:
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Pat.hs
- testsuite/tests/polykinds/T10451.stderr
- − testsuite/tests/rename/should_fail/T6148.stderr
- + testsuite/tests/rename/should_fail/T6148a.hs
- + testsuite/tests/rename/should_fail/T6148a.stderr
- + testsuite/tests/rename/should_fail/T6148b.hs
- + testsuite/tests/rename/should_fail/T6148b.stderr
- testsuite/tests/rename/should_fail/T6148.hs → testsuite/tests/rename/should_fail/T6148c.hs
- + testsuite/tests/rename/should_fail/T6148c.stderr
- testsuite/tests/rename/should_fail/all.T
- + testsuite/tests/typecheck/should_fail/T18723a.hs
- + testsuite/tests/typecheck/should_fail/T18723a.stderr
- + testsuite/tests/typecheck/should_fail/T18723b.hs
- + testsuite/tests/typecheck/should_fail/T18723b.stderr
- + testsuite/tests/typecheck/should_fail/T18723c.hs
- + testsuite/tests/typecheck/should_fail/T18723c.stderr
- testsuite/tests/typecheck/should_fail/all.T
Changes:
=====================================
compiler/GHC/Iface/Load.hs
=====================================
@@ -13,6 +13,7 @@ module GHC.Iface.Load (
-- Importing one thing
tcLookupImported_maybe, importDecl,
checkWiredInTyCon, ifCheckWiredInThing,
+ checkTupSize, checkCTupSize,
-- RnM/TcM functions
loadModuleInterface, loadModuleInterfaces,
@@ -56,6 +57,8 @@ import GHC.Builtin.Names
import GHC.Builtin.Utils
import GHC.Builtin.PrimOps ( allThePrimOps, primOpFixity, primOpOcc )
import GHC.Types.Id.Make ( seqId, EnableBignumRules(..) )
+import GHC.Core.ConLike
+import GHC.Core.DataCon
import GHC.Core.Rules
import GHC.Core.TyCon
import GHC.Types.Annotations
@@ -78,7 +81,6 @@ import GHC.Utils.Misc
import GHC.Data.FastString
import GHC.Utils.Fingerprint
import GHC.Driver.Hooks
-import GHC.Types.FieldLabel
import GHC.Iface.Rename
import GHC.Types.Unique.DSet
import GHC.Driver.Plugins
@@ -133,9 +135,28 @@ tcImportDecl_maybe name
= do { when (needWiredInHomeIface thing)
(initIfaceTcRn (loadWiredInHomeIface name))
-- See Note [Loading instances for wired-in things]
+ ; whenIsJust (tuple_ty_thing_maybe thing) checkTupSize
; return (Succeeded thing) }
| otherwise
= initIfaceTcRn (importDecl name)
+ where
+ -- Returns @Just arity@ if the supplied TyThing corresponds to a tuple
+ -- type or data constructor. Returns @Nothing@ otherwise.
+ tuple_ty_thing_maybe :: TyThing -> Maybe Arity
+ tuple_ty_thing_maybe thing
+ | Just tycon <- case thing of
+ ATyCon tc -> Just tc
+ AConLike (RealDataCon dc) -> Just (dataConTyCon dc)
+ _ -> Nothing
+ , Just tupleSort <- tyConTuple_maybe tycon
+ = Just $ case tupleSort of
+ -- Unboxed tuples have twice as many arguments because of the
+ -- 'RuntimeRep's (#17837)
+ UnboxedTuple -> tyConArity tycon `div` 2
+ _ -> tyConArity tycon
+
+ | otherwise
+ = Nothing
importDecl :: Name -> IfM lcl (MaybeErr MsgDoc TyThing)
-- Get the TyThing for this Name from an interface file
@@ -249,6 +270,27 @@ needWiredInHomeIface :: TyThing -> Bool
needWiredInHomeIface (ATyCon {}) = True
needWiredInHomeIface _ = False
+-- | Ensure that a boxed or unboxed tuple has arity no larger than
+-- 'mAX_TUPLE_SIZE'.
+checkTupSize :: Int -> TcM ()
+checkTupSize tup_size
+ | tup_size <= mAX_TUPLE_SIZE
+ = return ()
+ | otherwise
+ = addErr (sep [text "A" <+> int tup_size <> ptext (sLit "-tuple is too large for GHC"),
+ nest 2 (parens (text "max size is" <+> int mAX_TUPLE_SIZE)),
+ nest 2 (text "Workaround: use nested tuples or define a data type")])
+
+-- | Ensure that a constraint tuple has arity no larger than 'mAX_CTUPLE_SIZE'.
+checkCTupSize :: Int -> TcM ()
+checkCTupSize tup_size
+ | tup_size <= mAX_CTUPLE_SIZE
+ = return ()
+ | otherwise
+ = addErr (hang (text "Constraint tuple arity too large:" <+> int tup_size
+ <+> parens (text "max arity =" <+> int mAX_CTUPLE_SIZE))
+ 2 (text "Instead, use a nested tuple"))
+
{-
************************************************************************
=====================================
compiler/GHC/Rename/Env.hs
=====================================
@@ -70,7 +70,7 @@ import GHC.Core.DataCon
import GHC.Core.TyCon
import GHC.Utils.Error ( MsgDoc )
import GHC.Builtin.Names( rOOT_MAIN )
-import GHC.Types.Basic ( pprWarningTxtForMsg, TopLevelFlag(..), TupleSort(..) )
+import GHC.Types.Basic ( pprWarningTxtForMsg, TopLevelFlag(..) )
import GHC.Types.SrcLoc as SrcLoc
import GHC.Utils.Outputable as Outputable
import GHC.Types.Unique.Set ( uniqSetAny )
@@ -278,20 +278,6 @@ lookupLocatedTopBndrRn = wrapLocM lookupTopBndrRn
-- Note [Errors in lookup functions]
lookupExactOcc_either :: Name -> RnM (Either MsgDoc Name)
lookupExactOcc_either name
- | Just thing <- wiredInNameTyThing_maybe name
- , Just tycon <- case thing of
- ATyCon tc -> Just tc
- AConLike (RealDataCon dc) -> Just (dataConTyCon dc)
- _ -> Nothing
- , Just tupleSort <- tyConTuple_maybe tycon
- = do { let tupArity = case tupleSort of
- -- Unboxed tuples have twice as many arguments because of the
- -- 'RuntimeRep's (#17837)
- UnboxedTuple -> tyConArity tycon `div` 2
- _ -> tyConArity tycon
- ; checkTupSize tupArity
- ; return (Right name) }
-
| isExternalName name
= return (Right name)
=====================================
compiler/GHC/Rename/Expr.hs
=====================================
@@ -282,7 +282,6 @@ rnExpr (ExplicitList x _ exps)
rnExpr (ExplicitTuple x tup_args boxity)
= do { checkTupleSection tup_args
- ; checkTupSize (length tup_args)
; (tup_args', fvs) <- mapAndUnzipM rnTupArg tup_args
; return (ExplicitTuple x tup_args' boxity, plusFVs fvs) }
where
=====================================
compiler/GHC/Rename/Pat.hs
=====================================
@@ -38,8 +38,8 @@ module GHC.Rename.Pat (-- main entry points
-- Literals
rnLit, rnOverLit,
- -- Pattern Error messages that are also used elsewhere
- checkTupSize, patSigErr
+ -- Pattern Error message that is also used elsewhere
+ patSigErr
) where
-- ENH: thin imports to only what is necessary for patterns
@@ -60,7 +60,7 @@ import GHC.Rename.Utils ( HsDocContext(..), newLocalBndrRn, bindLocalNames
, warnUnusedMatches, newLocalBndrRn
, checkUnusedRecordWildcard
, checkDupNames, checkDupAndShadowedNames
- , checkTupSize , unknownSubordinateErr )
+ , unknownSubordinateErr )
import GHC.Rename.HsType
import GHC.Builtin.Names
import GHC.Types.Name
@@ -498,8 +498,7 @@ rnPatAndThen mk (ListPat _ pats)
False -> return (ListPat Nothing pats') }
rnPatAndThen mk (TuplePat x pats boxed)
- = do { liftCps $ checkTupSize (length pats)
- ; pats' <- rnLPatsAndThen mk pats
+ = do { pats' <- rnLPatsAndThen mk pats
; return (TuplePat x pats' boxed) }
rnPatAndThen mk (SumPat x pat alt arity)
=====================================
compiler/GHC/Rename/Utils.hs
=====================================
@@ -12,7 +12,6 @@ This module contains miscellaneous functions related to renaming.
module GHC.Rename.Utils (
checkDupRdrNames, checkShadowedRdrNames,
checkDupNames, checkDupAndShadowedNames, dupNamesErr,
- checkTupSize,
addFvRn, mapFvRn, mapMaybeFvRn,
warnUnusedMatches, warnUnusedTypePatterns,
warnUnusedTopBinds, warnUnusedLocalBinds,
@@ -58,7 +57,6 @@ import GHC.Driver.Session
import GHC.Data.FastString
import Control.Monad
import Data.List
-import GHC.Settings.Constants ( mAX_TUPLE_SIZE )
import qualified Data.List.NonEmpty as NE
import qualified GHC.LanguageExtensions as LangExt
@@ -573,15 +571,6 @@ typeAppErr what (L _ k)
<+> quotes (char '@' <> ppr k))
2 (text "Perhaps you intended to use TypeApplications")
-checkTupSize :: Int -> RnM ()
-checkTupSize tup_size
- | tup_size <= mAX_TUPLE_SIZE
- = return ()
- | otherwise
- = addErr (sep [text "A" <+> int tup_size <> ptext (sLit "-tuple is too large for GHC"),
- nest 2 (parens (text "max size is" <+> int mAX_TUPLE_SIZE)),
- nest 2 (text "Workaround: use nested tuples or define a data type")])
-
{-
************************************************************************
=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -31,6 +31,7 @@ import {-# SOURCE #-} GHC.Tc.Gen.Splice( tcSpliceExpr, tcTypedBracket, tcUntyp
import GHC.Builtin.Names.TH( liftStringName, liftName )
import GHC.Hs
+import GHC.Iface.Load
import GHC.Tc.Utils.Zonk
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.Unify
@@ -1548,7 +1549,9 @@ tcArg fun arg (Scaled mult ty) arg_no
----------------
tcTupArgs :: [LHsTupArg GhcRn] -> [TcSigmaType] -> TcM [LHsTupArg GhcTc]
tcTupArgs args tys
- = ASSERT( equalLength args tys ) mapM go (args `zip` tys)
+ = do MASSERT( equalLength args tys )
+ checkTupSize (length args)
+ mapM go (args `zip` tys)
where
go (L l (Missing {}), arg_ty) = do { mult <- newFlexiTyVarTy multiplicityTy
; return (L l (Missing (Scaled mult arg_ty))) }
=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -83,6 +83,7 @@ import GHC.Tc.Utils.TcMType
import GHC.Tc.Validity
import GHC.Tc.Utils.Unify
import GHC.IfaceToCore
+import GHC.Iface.Load
import GHC.Tc.Solver
import GHC.Tc.Utils.Zonk
import GHC.Core.TyCo.Rep
@@ -106,8 +107,6 @@ import GHC.Types.Var.Env
import GHC.Builtin.Types
import GHC.Types.Basic
import GHC.Types.SrcLoc
-import GHC.Settings.Constants ( mAX_CTUPLE_SIZE )
-import GHC.Utils.Error( MsgDoc )
import GHC.Types.Unique
import GHC.Types.Unique.FM
import GHC.Types.Unique.Set
@@ -1112,6 +1111,7 @@ tc_hs_type mode rn_ty@(HsExplicitTupleTy _ tys) exp_kind
; let kind_con = tupleTyCon Boxed arity
ty_con = promotedTupleDataCon Boxed arity
tup_k = mkTyConApp kind_con ks
+ ; checkTupSize arity
; checkExpectedKind rn_ty (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind }
where
arity = length tys
@@ -1266,33 +1266,28 @@ finish_tuple rn_ty tup_sort tau_tys tau_kinds exp_kind = do
-- Drop any uses of 1-tuple constraints here.
-- See Note [Ignore unary constraint tuples]
-> check_expected_kind tau_ty constraintKind
- | arity > mAX_CTUPLE_SIZE
- -> failWith (bigConstraintTuple arity)
| otherwise
- -> let tycon = cTupleTyCon arity in
- check_expected_kind (mkTyConApp tycon tau_tys) constraintKind
+ -> do let tycon = cTupleTyCon arity
+ checkCTupSize arity
+ check_expected_kind (mkTyConApp tycon tau_tys) constraintKind
BoxedTuple -> do
let tycon = tupleTyCon Boxed arity
+ checkTupSize arity
checkWiredInTyCon tycon
check_expected_kind (mkTyConApp tycon tau_tys) liftedTypeKind
- UnboxedTuple ->
+ UnboxedTuple -> do
let tycon = tupleTyCon Unboxed arity
tau_reps = map kindRep tau_kinds
-- See also Note [Unboxed tuple RuntimeRep vars] in GHC.Core.TyCon
arg_tys = tau_reps ++ tau_tys
- res_kind = unboxedTupleKind tau_reps in
+ res_kind = unboxedTupleKind tau_reps
+ checkTupSize arity
check_expected_kind (mkTyConApp tycon arg_tys) res_kind
where
arity = length tau_tys
check_expected_kind ty act_kind =
checkExpectedKind rn_ty ty act_kind exp_kind
-bigConstraintTuple :: Arity -> MsgDoc
-bigConstraintTuple arity
- = hang (text "Constraint tuple arity too large:" <+> int arity
- <+> parens (text "max arity =" <+> int mAX_CTUPLE_SIZE))
- 2 (text "Instead, use a nested tuple")
-
{-
Note [Ignore unary constraint tuples]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=====================================
compiler/GHC/Tc/Gen/Pat.hs
=====================================
@@ -33,6 +33,7 @@ import GHC.Prelude
import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcSyntaxOp, tcSyntaxOpGen, tcInferRho )
import GHC.Hs
+import GHC.Iface.Load
import GHC.Tc.Utils.Zonk
import GHC.Tc.Gen.Sig( TcPragEnv, lookupPragEnv, addInlinePrags )
import GHC.Tc.Utils.Monad
@@ -511,6 +512,7 @@ Fortunately that's what matchExpectedFunTySigma returns anyway.
tc = tupleTyCon boxity arity
-- NB: tupleTyCon does not flatten 1-tuples
-- See Note [Don't flatten tuples from HsSyn] in GHC.Core.Make
+ ; checkTupSize arity
; (coi, arg_tys) <- matchExpectedPatTy (matchExpectedTyConApp tc)
penv (scaledThing pat_ty)
-- Unboxed tuples have RuntimeRep vars, which we discard:
=====================================
testsuite/tests/polykinds/T10451.stderr
=====================================
@@ -1,11 +1,12 @@
T10451.hs:22:12: error:
- Constraint tuple arity too large: 64 (max arity = 62)
- Instead, use a nested tuple
- In the type ‘(Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
- Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
- Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
- Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
- Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
- Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a)’
- In the type declaration for ‘T’
+ • Constraint tuple arity too large: 64 (max arity = 62)
+ Instead, use a nested tuple
+ • In the type ‘(Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
+ Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
+ Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
+ Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
+ Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
+ Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
+ Eq a)’
+ In the type declaration for ‘T’
=====================================
testsuite/tests/rename/should_fail/T6148.stderr deleted
=====================================
@@ -1,15 +0,0 @@
-
-T6148.hs:3:5:
- A 63-tuple is too large for GHC
- (max size is 62)
- Workaround: use nested tuples or define a data type
-
-T6148.hs:7:5:
- A 63-tuple is too large for GHC
- (max size is 62)
- Workaround: use nested tuples or define a data type
-
-T6148.hs:11:6:
- A 63-tuple is too large for GHC
- (max size is 62)
- Workaround: use nested tuples or define a data type
=====================================
testsuite/tests/rename/should_fail/T6148a.hs
=====================================
@@ -0,0 +1,4 @@
+module T6148a where
+
+a = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
=====================================
testsuite/tests/rename/should_fail/T6148a.stderr
=====================================
@@ -0,0 +1,13 @@
+
+T6148a.hs:3:5: error:
+ • A 63-tuple is too large for GHC
+ (max size is 62)
+ Workaround: use nested tuples or define a data type
+ • In the expression:
+ (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ In an equation for ‘a’:
+ a = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
=====================================
testsuite/tests/rename/should_fail/T6148b.hs
=====================================
@@ -0,0 +1,3 @@
+module T6148b where
+
+b = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
=====================================
testsuite/tests/rename/should_fail/T6148b.stderr
=====================================
@@ -0,0 +1,9 @@
+
+T6148b.hs:3:5: error:
+ • A 63-tuple is too large for GHC
+ (max size is 62)
+ Workaround: use nested tuples or define a data type
+ • In the expression:
+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
+ In an equation for ‘b’:
+ b = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
=====================================
testsuite/tests/rename/should_fail/T6148.hs → testsuite/tests/rename/should_fail/T6148c.hs
=====================================
@@ -1,14 +1,8 @@
-module T6148 where
-
-a = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
-
-
-b = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
+module T6148c where
data T = T
-c :: (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
+c :: (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T
T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T
T T T
=====================================
testsuite/tests/rename/should_fail/T6148c.stderr
=====================================
@@ -0,0 +1,7 @@
+
+T6148c.hs:5:6: error:
+ • A 63-tuple is too large for GHC
+ (max size is 62)
+ Workaround: use nested tuples or define a data type
+ • In the type signature:
+ c :: (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T
=====================================
testsuite/tests/rename/should_fail/all.T
=====================================
@@ -87,7 +87,9 @@ test('T5892b', normal, compile_fail, ['-package containers'])
test('T5951', normal, compile_fail, [''])
test('T6018rnfail', normal, compile_fail, [''])
test('T6060', normal, compile_fail, [''])
-test('T6148', normal, compile_fail, [''])
+test('T6148a', normal, compile_fail, [''])
+test('T6148b', normal, compile_fail, [''])
+test('T6148c', normal, compile_fail, [''])
test('T7164', normal, compile_fail, [''])
test('T7338', normal, compile_fail, [''])
test('T7338a', normal, compile_fail, [''])
=====================================
testsuite/tests/typecheck/should_fail/T18723a.hs
=====================================
@@ -0,0 +1,11 @@
+module T18723a where
+
+data T1 = MkT1
+ ( Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int
+ )
=====================================
testsuite/tests/typecheck/should_fail/T18723a.stderr
=====================================
@@ -0,0 +1,13 @@
+
+T18723a.hs:4:3: error:
+ • A 63-tuple is too large for GHC
+ (max size is 62)
+ Workaround: use nested tuples or define a data type
+ • In the type ‘(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int)’
+ In the definition of data constructor ‘MkT1’
+ In the data declaration for ‘T1’
=====================================
testsuite/tests/typecheck/should_fail/T18723b.hs
=====================================
@@ -0,0 +1,14 @@
+{-# LANGUAGE DataKinds #-}
+module T18723b where
+
+import Data.Proxy
+
+data T2 = MkT2 (Proxy
+ '( Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int
+ ))
=====================================
testsuite/tests/typecheck/should_fail/T18723b.stderr
=====================================
@@ -0,0 +1,133 @@
+
+T18723b.hs:7:2: error:
+ • A 63-tuple is too large for GHC
+ (max size is 62)
+ Workaround: use nested tuples or define a data type
+ • In the first argument of ‘Proxy’, namely
+ ‘'(Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int)’
+ In the type ‘(Proxy '(Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int,
+ Int))’
+ In the definition of data constructor ‘MkT2’
=====================================
testsuite/tests/typecheck/should_fail/T18723c.hs
=====================================
@@ -0,0 +1,12 @@
+{-# LANGUAGE UnboxedTuples #-}
+module T18723c where
+
+data T3 = MkT3
+ (# Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
+ , Int, Int, Int
+ #)
=====================================
testsuite/tests/typecheck/should_fail/T18723c.stderr
=====================================
@@ -0,0 +1,13 @@
+
+T18723c.hs:5:2: error:
+ • A 63-tuple is too large for GHC
+ (max size is 62)
+ Workaround: use nested tuples or define a data type
+ • In the type ‘(# Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
+ Int #)’
+ In the definition of data constructor ‘MkT3’
+ In the data declaration for ‘T3’
=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -579,3 +579,6 @@ test('T18357a', normal, compile_fail, [''])
test('T18357b', normal, compile_fail, [''])
test('T18455', normal, compile_fail, [''])
test('T18534', normal, compile_fail, [''])
+test('T18723a', normal, compile_fail, [''])
+test('T18723b', normal, compile_fail, [''])
+test('T18723c', normal, compile_fail, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8af17561b3a504de26cef5ca465cba7283fc4f6c
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8af17561b3a504de26cef5ca465cba7283fc4f6c
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200921/54752935/attachment-0001.html>
More information about the ghc-commits
mailing list