diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-11-15 23:22:06 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-11-16 08:55:07 -0500 |
commit | fc4d8f1e72cf6aaa7d1bacafa201e3553a63d93a (patch) | |
tree | 672569f812aae2ccf20c5251fd20524139dcdce7 /testsuite/tests | |
parent | cc635da167fdec2dead0603b0026cb841f0aa645 (diff) | |
download | haskell-wip/T20541.tar.gz |
Increase type sharingwip/T20541
Fixes #20541 by making mkTyConApp do more sharing of types.
In particular, replace
* BoxedRep Lifted ==> LiftedRep
* BoxedRep Unlifted ==> UnliftedRep
* TupleRep '[] ==> ZeroBitRep
* TYPE ZeroBitRep ==> ZeroBitType
In each case, the thing on the right is a type synonym
for the thing on the left, declared in ghc-prim:GHC.Types.
See Note [Using synonyms to compress types] in GHC.Core.Type.
The synonyms for ZeroBitRep and ZeroBitType are new, but absolutely
in the same spirit as the other ones. (These synonyms are mainly
for internal use, though the programmer can use them too.)
I also renamed GHC.Core.Ty.Rep.isVoidTy to isZeroBitTy, to be
compatible with the "zero-bit" nomenclature above. See discussion
on !6806.
There is a tricky wrinkle: see GHC.Core.Types
Note [Care using synonyms to compress types]
Compiler allocation decreases by up to 0.8%.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/dependent/should_fail/T17131.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T7627.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins09.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins10.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins11.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/plugins/static-plugins.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T18013.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T15883b.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T15883c.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T15883d.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T15883e.stderr | 12 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_run/KindInvariant.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/unboxedsums/T12711.stdout | 4 |
13 files changed, 25 insertions, 33 deletions
diff --git a/testsuite/tests/dependent/should_fail/T17131.stderr b/testsuite/tests/dependent/should_fail/T17131.stderr index b2af8ab7b8..3ab5c50665 100644 --- a/testsuite/tests/dependent/should_fail/T17131.stderr +++ b/testsuite/tests/dependent/should_fail/T17131.stderr @@ -1,9 +1,9 @@ T17131.hs:12:34: error: • Couldn't match kind: TypeReps xs - with: '[ 'BoxedRep 'Lifted] + with: '[LiftedRep] Expected kind ‘TYPE ('TupleRep (TypeReps xs))’, - but ‘(# a #)’ has kind ‘TYPE ('TupleRep '[ 'BoxedRep 'Lifted])’ + but ‘(# a #)’ has kind ‘TYPE ('TupleRep '[LiftedRep])’ The type variable ‘xs’ is ambiguous • In the type ‘(# a #)’ In the type family declaration for ‘Tuple#’ diff --git a/testsuite/tests/ghci/scripts/T7627.stdout b/testsuite/tests/ghci/scripts/T7627.stdout index 2a2b8bd58f..0bc51c87b5 100644 --- a/testsuite/tests/ghci/scripts/T7627.stdout +++ b/testsuite/tests/ghci/scripts/T7627.stdout @@ -9,7 +9,7 @@ instance Enum () -- Defined in ‘GHC.Enum’ instance Show () -- Defined in ‘GHC.Show’ instance Read () -- Defined in ‘GHC.Read’ instance Bounded () -- Defined in ‘GHC.Enum’ -type (##) :: TYPE ('GHC.Types.TupleRep '[]) +type (##) :: GHC.Types.ZeroBitType data (##) = (##) -- Defined in ‘GHC.Prim’ () :: () diff --git a/testsuite/tests/plugins/plugins09.stdout b/testsuite/tests/plugins/plugins09.stdout index f32fbe4a09..b68572dd7a 100644 --- a/testsuite/tests/plugins/plugins09.stdout +++ b/testsuite/tests/plugins/plugins09.stdout @@ -4,6 +4,5 @@ interfacePlugin: GHC.Base interfacePlugin: GHC.Float interfacePlugin: GHC.Prim.Ext typeCheckPlugin (rn) -interfacePlugin: GHC.Prim typeCheckPlugin (tc) interfacePlugin: GHC.Num.BigNat diff --git a/testsuite/tests/plugins/plugins10.stdout b/testsuite/tests/plugins/plugins10.stdout index f9aa7f19b6..7f565937cf 100644 --- a/testsuite/tests/plugins/plugins10.stdout +++ b/testsuite/tests/plugins/plugins10.stdout @@ -7,7 +7,6 @@ interfacePlugin: GHC.Float interfacePlugin: GHC.Prim.Ext interfacePlugin: Language.Haskell.TH.Syntax typeCheckPlugin (rn) -interfacePlugin: GHC.Prim typeCheckPlugin (tc) interfacePlugin: GHC.Num.BigNat parsePlugin(a) diff --git a/testsuite/tests/plugins/plugins11.stdout b/testsuite/tests/plugins/plugins11.stdout index 0a9c0dcb88..cac32c0701 100644 --- a/testsuite/tests/plugins/plugins11.stdout +++ b/testsuite/tests/plugins/plugins11.stdout @@ -4,6 +4,5 @@ interfacePlugin: GHC.Base interfacePlugin: GHC.Float interfacePlugin: GHC.Prim.Ext typeCheckPlugin (rn) -interfacePlugin: GHC.Prim typeCheckPlugin (tc) interfacePlugin: GHC.Num.BigNat diff --git a/testsuite/tests/plugins/static-plugins.stdout b/testsuite/tests/plugins/static-plugins.stdout index 3f7387fc4c..5da8e9bee8 100644 --- a/testsuite/tests/plugins/static-plugins.stdout +++ b/testsuite/tests/plugins/static-plugins.stdout @@ -6,12 +6,12 @@ interfacePlugin: GHC.Float interfacePlugin: GHC.Prim.Ext interfacePlugin: System.IO typeCheckPlugin (rn) -interfacePlugin: GHC.Prim interfacePlugin: GHC.Types interfacePlugin: GHC.Show interfacePlugin: GHC.TopHandler typeCheckPlugin (tc) interfacePlugin: GHC.CString +interfacePlugin: GHC.Prim interfacePlugin: GHC.Num.BigNat ==pure.1 ==fp0.0 diff --git a/testsuite/tests/simplCore/should_compile/T18013.stderr b/testsuite/tests/simplCore/should_compile/T18013.stderr index 134078e7e8..fe48290c49 100644 --- a/testsuite/tests/simplCore/should_compile/T18013.stderr +++ b/testsuite/tests/simplCore/should_compile/T18013.stderr @@ -131,9 +131,9 @@ Rule fired: Class op fmap (BUILTIN) ==================== Tidy Core ==================== Result size of Tidy Core - = {terms: 52, types: 102, coercions: 17, joins: 0/1} + = {terms: 52, types: 95, coercions: 17, joins: 0/1} --- RHS size: {terms: 37, types: 85, coercions: 17, joins: 0/1} +-- RHS size: {terms: 37, types: 78, coercions: 17, joins: 0/1} mapMaybeRule [InlPrag=[2]] :: forall a b. Rule IO a b -> Rule IO (Maybe a) (Maybe b) [GblId, diff --git a/testsuite/tests/typecheck/should_fail/T15883b.stderr b/testsuite/tests/typecheck/should_fail/T15883b.stderr index 81c6da1b69..4da31915ac 100644 --- a/testsuite/tests/typecheck/should_fail/T15883b.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883b.stderr @@ -6,13 +6,13 @@ T15883b.hs:14:1: error: These potential instances exist: instance Eq SpecConstrAnnotation -- Defined in ‘GHC.Exts’ instance Eq Ordering -- Defined in ‘GHC.Classes’ - instance Eq (Foo ('BoxedRep 'Lifted)) -- Defined at T15883b.hs:14:1 + instance Eq (Foo LiftedRep) -- Defined at T15883b.hs:14:1 ...plus 24 others ...plus four instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: a1 == b1 In an equation for ‘==’: (==) (MkFoo a1) (MkFoo b1) = ((a1 == b1)) When typechecking the code for ‘==’ - in a derived instance for ‘Eq (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Eq (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv - In the instance declaration for ‘Eq (Foo ('BoxedRep 'Lifted))’ + In the instance declaration for ‘Eq (Foo LiftedRep)’ diff --git a/testsuite/tests/typecheck/should_fail/T15883c.stderr b/testsuite/tests/typecheck/should_fail/T15883c.stderr index 4ef9e5ef52..07451af880 100644 --- a/testsuite/tests/typecheck/should_fail/T15883c.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883c.stderr @@ -1,8 +1,8 @@ T15883c.hs:14:1: error: - • No instance for (Eq (Foo ('BoxedRep 'Lifted))) + • No instance for (Eq (Foo LiftedRep)) arising from the superclasses of an instance declaration - • In the instance declaration for ‘Ord (Foo ('BoxedRep 'Lifted))’ + • In the instance declaration for ‘Ord (Foo LiftedRep)’ T15883c.hs:14:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘compare’ @@ -10,8 +10,7 @@ T15883c.hs:14:1: error: Probable fix: use a type annotation to specify what ‘a0’ should be. These potential instances exist: instance Ord Ordering -- Defined in ‘GHC.Classes’ - instance Ord (Foo ('BoxedRep 'Lifted)) - -- Defined at T15883c.hs:14:1 + instance Ord (Foo LiftedRep) -- Defined at T15883c.hs:14:1 instance Ord Integer -- Defined in ‘GHC.Num.Integer’ ...plus 23 others ...plus two instances involving out-of-scope types @@ -20,7 +19,7 @@ T15883c.hs:14:1: error: In a case alternative: MkFoo b1 -> (a1 `compare` b1) In the expression: case b of MkFoo b1 -> (a1 `compare` b1) When typechecking the code for ‘compare’ - in a derived instance for ‘Ord (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Ord (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv T15883c.hs:14:1: error: @@ -29,8 +28,7 @@ T15883c.hs:14:1: error: Probable fix: use a type annotation to specify what ‘a1’ should be. These potential instances exist: instance Ord Ordering -- Defined in ‘GHC.Classes’ - instance Ord (Foo ('BoxedRep 'Lifted)) - -- Defined at T15883c.hs:14:1 + instance Ord (Foo LiftedRep) -- Defined at T15883c.hs:14:1 instance Ord Integer -- Defined in ‘GHC.Num.Integer’ ...plus 23 others ...plus two instances involving out-of-scope types @@ -39,5 +37,5 @@ T15883c.hs:14:1: error: In a case alternative: MkFoo b1 -> (a1 < b1) In the expression: case b of MkFoo b1 -> (a1 < b1) When typechecking the code for ‘<’ - in a derived instance for ‘Ord (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Ord (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv diff --git a/testsuite/tests/typecheck/should_fail/T15883d.stderr b/testsuite/tests/typecheck/should_fail/T15883d.stderr index 67ce3eff57..ba5618628d 100644 --- a/testsuite/tests/typecheck/should_fail/T15883d.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883d.stderr @@ -5,8 +5,7 @@ T15883d.hs:14:1: error: Probable fix: use a type annotation to specify what ‘a0’ should be. These potential instances exist: instance Show Ordering -- Defined in ‘GHC.Show’ - instance Show (Foo ('BoxedRep 'Lifted)) - -- Defined at T15883d.hs:14:1 + instance Show (Foo LiftedRep) -- Defined at T15883d.hs:14:1 instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ ...plus 28 others ...plus 9 instances involving out-of-scope types @@ -17,5 +16,5 @@ T15883d.hs:14:1: error: In the expression: showParen (a >= 11) ((.) (showString "MkFoo ") (showsPrec 11 b1)) When typechecking the code for ‘showsPrec’ - in a derived instance for ‘Show (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Show (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv diff --git a/testsuite/tests/typecheck/should_fail/T15883e.stderr b/testsuite/tests/typecheck/should_fail/T15883e.stderr index 72483274e9..81b6d8172a 100644 --- a/testsuite/tests/typecheck/should_fail/T15883e.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883e.stderr @@ -15,9 +15,9 @@ T15883e.hs:16:1: error: In an equation for ‘Data.Data.gfoldl’: Data.Data.gfoldl k z (MkFoo a1) = (z (\ a1 -> MkFoo a1) `k` a1) When typechecking the code for ‘Data.Data.gfoldl’ - in a derived instance for ‘Data (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Data (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv - In the instance declaration for ‘Data (Foo ('BoxedRep 'Lifted))’ + In the instance declaration for ‘Data (Foo LiftedRep)’ T15883e.hs:16:1: error: • Couldn't match expected type ‘a’ with actual type ‘d0’ @@ -30,7 +30,7 @@ T15883e.hs:16:1: error: In the expression: MkFoo a1 In the first argument of ‘z’, namely ‘(\ a1 -> MkFoo a1)’ When typechecking the code for ‘Data.Data.gfoldl’ - in a derived instance for ‘Data (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Data (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv • Relevant bindings include a1 :: d0 (bound at T15883e.hs:16:1) @@ -50,9 +50,9 @@ T15883e.hs:16:1: error: In an equation for ‘Data.Data.gunfold’: Data.Data.gunfold k z _ = k (z (\ a1 -> MkFoo a1)) When typechecking the code for ‘Data.Data.gunfold’ - in a derived instance for ‘Data (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Data (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv - In the instance declaration for ‘Data (Foo ('BoxedRep 'Lifted))’ + In the instance declaration for ‘Data (Foo LiftedRep)’ T15883e.hs:16:1: error: • Couldn't match expected type ‘a’ with actual type ‘b0’ @@ -65,6 +65,6 @@ T15883e.hs:16:1: error: In the expression: MkFoo a1 In the first argument of ‘z’, namely ‘(\ a1 -> MkFoo a1)’ When typechecking the code for ‘Data.Data.gunfold’ - in a derived instance for ‘Data (Foo ('BoxedRep 'Lifted))’: + in a derived instance for ‘Data (Foo LiftedRep)’: To see the code I am typechecking, use -ddump-deriv • Relevant bindings include a1 :: b0 (bound at T15883e.hs:16:1) diff --git a/testsuite/tests/typecheck/should_run/KindInvariant.stderr b/testsuite/tests/typecheck/should_run/KindInvariant.stderr index 9d404ae088..fb4dd69779 100644 --- a/testsuite/tests/typecheck/should_run/KindInvariant.stderr +++ b/testsuite/tests/typecheck/should_run/KindInvariant.stderr @@ -2,6 +2,6 @@ <interactive>:1:3: error: • Couldn't match a lifted type with an unlifted type Expected kind ‘* -> *’, - but ‘State#’ has kind ‘* -> TYPE ('TupleRep '[])’ + but ‘State#’ has kind ‘* -> GHC.Types.ZeroBitType’ • In the first argument of ‘T’, namely ‘State#’ In the type ‘T State#’ diff --git a/testsuite/tests/unboxedsums/T12711.stdout b/testsuite/tests/unboxedsums/T12711.stdout index 18a67a078d..2db54da01b 100644 --- a/testsuite/tests/unboxedsums/T12711.stdout +++ b/testsuite/tests/unboxedsums/T12711.stdout @@ -1,4 +1,2 @@ (# _ | _ #) :: TYPE - ('GHC.Types.SumRep - '[ 'GHC.Types.BoxedRep 'GHC.Types.Lifted, - 'GHC.Types.BoxedRep 'GHC.Types.Lifted]) + ('GHC.Types.SumRep '[GHC.Types.LiftedRep, GHC.Types.LiftedRep]) |