summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving
diff options
context:
space:
mode:
authorAndrzej Rybczak <andrzej@rybczak.net>2020-03-25 19:28:43 +0100
committerAndrzej Rybczak <andrzej@rybczak.net>2020-10-15 11:40:32 +0200
commit998803dc4dbceb36074644483e11e6183fa5355a (patch)
tree3c6ec7866d001b549b36050da6e946d3b6d83f1d /testsuite/tests/deriving
parent3d7db1488c4bd7764e8b1fe3cfde4c5a548cde16 (diff)
downloadhaskell-998803dc4dbceb36074644483e11e6183fa5355a.tar.gz
Add flags for annotating Generic{,1} methods INLINE[1] (#11068)
Makes it possible for GHC to optimize away intermediate Generic representation for more types. Metric Increase: T12227
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r--testsuite/tests/deriving/should_compile/T11068_aggressive.hs12
-rw-r--r--testsuite/tests/deriving/should_compile/T11068_aggressive.stderr250
-rw-r--r--testsuite/tests/deriving/should_compile/all.T1
3 files changed, 263 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_compile/T11068_aggressive.hs b/testsuite/tests/deriving/should_compile/T11068_aggressive.hs
new file mode 100644
index 0000000000..40c539d37e
--- /dev/null
+++ b/testsuite/tests/deriving/should_compile/T11068_aggressive.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE DeriveGeneric #-}
+{-# OPTIONS_GHC -finline-generics-aggressively #-}
+module T11068_aggressive where
+
+import GHC.Generics
+
+-- For 2 data constructors -finline-generics annotates class methods of the
+-- derived Generic instance as INLINE[1] only if each has at most 5 fields.
+data X
+ = X1 Int Int Int Int Int Int Int Int Int Int
+ | X2 Int Int Int Int Int Int Int Int Int Int
+ deriving Generic
diff --git a/testsuite/tests/deriving/should_compile/T11068_aggressive.stderr b/testsuite/tests/deriving/should_compile/T11068_aggressive.stderr
new file mode 100644
index 0000000000..497b1bc3a0
--- /dev/null
+++ b/testsuite/tests/deriving/should_compile/T11068_aggressive.stderr
@@ -0,0 +1,250 @@
+
+==================== Derived instances ====================
+Derived class instances:
+ instance GHC.Generics.Generic T11068_aggressive.X where
+ {-# INLINE [1] GHC.Generics.from #-}
+ {-# INLINE [1] GHC.Generics.to #-}
+ GHC.Generics.from x
+ = GHC.Generics.M1
+ (case x of
+ T11068_aggressive.X1 g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
+ -> GHC.Generics.L1
+ (GHC.Generics.M1
+ ((GHC.Generics.:*:)
+ ((GHC.Generics.:*:)
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g1))
+ (GHC.Generics.M1 (GHC.Generics.K1 g2)))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g3))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g4))
+ (GHC.Generics.M1 (GHC.Generics.K1 g5)))))
+ ((GHC.Generics.:*:)
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g6))
+ (GHC.Generics.M1 (GHC.Generics.K1 g7)))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g8))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g9))
+ (GHC.Generics.M1 (GHC.Generics.K1 g10)))))))
+ T11068_aggressive.X2 g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
+ -> GHC.Generics.R1
+ (GHC.Generics.M1
+ ((GHC.Generics.:*:)
+ ((GHC.Generics.:*:)
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g1))
+ (GHC.Generics.M1 (GHC.Generics.K1 g2)))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g3))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g4))
+ (GHC.Generics.M1 (GHC.Generics.K1 g5)))))
+ ((GHC.Generics.:*:)
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g6))
+ (GHC.Generics.M1 (GHC.Generics.K1 g7)))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g8))
+ ((GHC.Generics.:*:)
+ (GHC.Generics.M1 (GHC.Generics.K1 g9))
+ (GHC.Generics.M1 (GHC.Generics.K1 g10))))))))
+ GHC.Generics.to (GHC.Generics.M1 x)
+ = case x of
+ (GHC.Generics.L1 (GHC.Generics.M1 ((GHC.Generics.:*:) ((GHC.Generics.:*:) ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g1))
+ (GHC.Generics.M1 (GHC.Generics.K1 g2)))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g3))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g4))
+ (GHC.Generics.M1 (GHC.Generics.K1 g5)))))
+ ((GHC.Generics.:*:) ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g6))
+ (GHC.Generics.M1 (GHC.Generics.K1 g7)))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g8))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g9))
+ (GHC.Generics.M1 (GHC.Generics.K1 g10))))))))
+ -> T11068_aggressive.X1 g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
+ (GHC.Generics.R1 (GHC.Generics.M1 ((GHC.Generics.:*:) ((GHC.Generics.:*:) ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g1))
+ (GHC.Generics.M1 (GHC.Generics.K1 g2)))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g3))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g4))
+ (GHC.Generics.M1 (GHC.Generics.K1 g5)))))
+ ((GHC.Generics.:*:) ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g6))
+ (GHC.Generics.M1 (GHC.Generics.K1 g7)))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g8))
+ ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g9))
+ (GHC.Generics.M1 (GHC.Generics.K1 g10))))))))
+ -> T11068_aggressive.X2 g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
+
+
+Derived type family instances:
+ type GHC.Generics.Rep T11068_aggressive.X = GHC.Generics.D1
+ ('GHC.Generics.MetaData
+ "X" "T11068_aggressive" "main" 'GHC.Types.False)
+ (GHC.Generics.C1
+ ('GHC.Generics.MetaCons
+ "X1" 'GHC.Generics.PrefixI 'GHC.Types.False)
+ (((GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0 GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int))
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int))))
+ GHC.Generics.:*: ((GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int))
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)))))
+ GHC.Generics.:+: GHC.Generics.C1
+ ('GHC.Generics.MetaCons
+ "X2"
+ 'GHC.Generics.PrefixI
+ 'GHC.Types.False)
+ (((GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int))
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int))))
+ GHC.Generics.:*: ((GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int))
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: (GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int)
+ GHC.Generics.:*: GHC.Generics.S1
+ ('GHC.Generics.MetaSel
+ 'GHC.Maybe.Nothing
+ 'GHC.Generics.NoSourceUnpackedness
+ 'GHC.Generics.NoSourceStrictness
+ 'GHC.Generics.DecidedLazy)
+ (GHC.Generics.Rec0
+ GHC.Types.Int))))))
diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T
index 86a48ccf7b..4e938809be 100644
--- a/testsuite/tests/deriving/should_compile/all.T
+++ b/testsuite/tests/deriving/should_compile/all.T
@@ -65,6 +65,7 @@ test('T7947', [], multimod_compile, ['T7947', '-v0'])
test('T10561', normal, compile, [''])
test('T10487', [], multimod_compile, ['T10487', '-v0'])
test('T10524', normal, compile, [''])
+test('T11068_aggressive', [normalise_errmsg_fun(just_the_deriving)], compile, ['-ddump-deriv -dsuppress-uniques'])
test('T11148', normal, makefile_test, [])
test('T9968', normal, compile, [''])
test('T9968a', normal, compile, [''])