diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2022-11-18 12:53:00 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-11-25 04:39:04 -0500 |
commit | 13d627bbd0bc3dd30d672de341aa7f471be0aa2c (patch) | |
tree | 3464a8c6dca4b9bb47db356352d964279eca94fe /testsuite/tests/typecheck/should_fail | |
parent | 1f1b99b86ab2b005604aea08b0614279a8ad1244 (diff) | |
download | haskell-13d627bbd0bc3dd30d672de341aa7f471be0aa2c.tar.gz |
Print unticked promoted data constructors (#20531)
Before this patch, GHC unconditionally printed ticks before promoted
data constructors:
ghci> type T = True -- unticked (user-written)
ghci> :kind! T
T :: Bool
= 'True -- ticked (compiler output)
After this patch, GHC prints ticks only when necessary:
ghci> type F = False -- unticked (user-written)
ghci> :kind! F
F :: Bool
= False -- unticked (compiler output)
ghci> data False -- introduce ambiguity
ghci> :kind! F
F :: Bool
= 'False -- ticked by necessity (compiler output)
The old behavior can be enabled by -fprint-redundant-promotion-ticks.
Summary of changes:
* Rename PrintUnqualified to NamePprCtx
* Add QueryPromotionTick to it
* Consult the GlobalRdrEnv to decide whether to print a tick (see mkPromTick)
* Introduce -fprint-redundant-promotion-ticks
Co-authored-by: Artyom Kuznetsov <hi@wzrd.ht>
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
21 files changed, 47 insertions, 47 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T12102b.stderr b/testsuite/tests/typecheck/should_fail/T12102b.stderr index 57ba1395b6..cecd4aa7ee 100644 --- a/testsuite/tests/typecheck/should_fail/T12102b.stderr +++ b/testsuite/tests/typecheck/should_fail/T12102b.stderr @@ -1,6 +1,6 @@ T12102b.hs:21:25: error: [GHC-83865] - • Couldn't match expected kind ‘'True’ + • Couldn't match expected kind ‘True’ with actual kind ‘IsTypeLit a’ • In the first argument of ‘Show’, namely ‘(T a)’ In the stand-alone deriving instance for ‘Show (T a)’ diff --git a/testsuite/tests/typecheck/should_fail/T12729.stderr b/testsuite/tests/typecheck/should_fail/T12729.stderr index 7bb0aedc12..d638aa7e7c 100644 --- a/testsuite/tests/typecheck/should_fail/T12729.stderr +++ b/testsuite/tests/typecheck/should_fail/T12729.stderr @@ -1,5 +1,5 @@ T12729.hs:7:1: error: [GHC-55233] - • Newtype has non-* return kind ‘TYPE 'IntRep’ + • Newtype has non-* return kind ‘TYPE IntRep’ • In the newtype declaration for ‘A’ Suggested fix: Perhaps you intended to use UnliftedNewtypes diff --git a/testsuite/tests/typecheck/should_fail/T12785b.stderr b/testsuite/tests/typecheck/should_fail/T12785b.stderr index ee1158ce9e..abcdee7619 100644 --- a/testsuite/tests/typecheck/should_fail/T12785b.stderr +++ b/testsuite/tests/typecheck/should_fail/T12785b.stderr @@ -1,11 +1,11 @@ T12785b.hs:30:65: error: [GHC-25897] - • Could not deduce ‘Payload ('S n) (Payload n s1) ~ s’ + • Could not deduce ‘Payload (S n) (Payload n s1) ~ s’ arising from a use of ‘SBranchX’ - from the context: m ~ 'S n + from the context: m ~ S n bound by a pattern with constructor: Branch :: forall a (n :: Peano). - a -> HTree n (HTree ('S n) a) -> HTree ('S n) a, + a -> HTree n (HTree (S n) a) -> HTree (S n) a, in an equation for ‘nest’ at T12785b.hs:30:7-51 ‘s’ is a rigid type variable bound by @@ -20,8 +20,8 @@ T12785b.hs:30:65: error: [GHC-25897] nest (Hide a `Branch` (nest . hmap nest -> Hide tr)) = Hide $ a `SBranchX` tr • Relevant bindings include - tr :: STree n (STree ('S n) (STree ('S ('S n)) f)) s1 + tr :: STree n (STree (S n) (STree (S (S n)) f)) s1 (bound at T12785b.hs:30:49) - a :: STree ('S m) f s (bound at T12785b.hs:30:12) - nest :: HTree m (Hidden ('S m) f) -> Hidden m (STree ('S m) f) + a :: STree (S m) f s (bound at T12785b.hs:30:12) + nest :: HTree m (Hidden (S m) f) -> Hidden m (STree (S m) f) (bound at T12785b.hs:28:1) diff --git a/testsuite/tests/typecheck/should_fail/T13530.stderr b/testsuite/tests/typecheck/should_fail/T13530.stderr index 31c294d654..25100b827b 100644 --- a/testsuite/tests/typecheck/should_fail/T13530.stderr +++ b/testsuite/tests/typecheck/should_fail/T13530.stderr @@ -3,7 +3,7 @@ T13530.hs:11:7: error: [GHC-18872] • Couldn't match a lifted type with an unlifted type When matching types a0 :: * - Int# :: TYPE 'IntRep + Int# :: TYPE IntRep Expected: (# Int#, Int# #) Actual: (# Int#, a0 #) • In the expression: g x diff --git a/testsuite/tests/typecheck/should_fail/T15067.stderr b/testsuite/tests/typecheck/should_fail/T15067.stderr index 64d322f927..efa7373b8f 100644 --- a/testsuite/tests/typecheck/should_fail/T15067.stderr +++ b/testsuite/tests/typecheck/should_fail/T15067.stderr @@ -6,6 +6,6 @@ T15067.hs:9:14: error: [GHC-39999] Typeable ((# | #) :: * -> * -> TYPE - ('GHC.Types.SumRep '[GHC.Types.LiftedRep, GHC.Types.LiftedRep])) + (GHC.Types.SumRep [GHC.Types.LiftedRep, GHC.Types.LiftedRep])) • In the expression: typeRep In an equation for ‘floopadoop’: floopadoop = typeRep diff --git a/testsuite/tests/typecheck/should_fail/T15330.stderr b/testsuite/tests/typecheck/should_fail/T15330.stderr index 19ec29e90f..7c91463570 100644 --- a/testsuite/tests/typecheck/should_fail/T15330.stderr +++ b/testsuite/tests/typecheck/should_fail/T15330.stderr @@ -1,18 +1,18 @@ T15330.hs:12:6: error: [GHC-83865] • Couldn't match type: [Char] - with: Proxy (T 'True) - Expected: Proxy (T 'True) + with: Proxy (T True) + Expected: Proxy (T True) Actual: String • In the expression: "foo" In an equation for ‘f1’: f1 = "foo" T15330.hs:16:6: error: [GHC-83865] • Couldn't match type: [Char] - with: Proxy (t 'True) - Expected: Proxy (t 'True) + with: Proxy (t True) + Expected: Proxy (t True) Actual: String • In the expression: "foo" In an equation for ‘f2’: f2 = "foo" • Relevant bindings include - f2 :: Proxy (t 'True) (bound at T15330.hs:16:1) + f2 :: Proxy (t True) (bound at T15330.hs:16:1) diff --git a/testsuite/tests/typecheck/should_fail/T15962.stderr b/testsuite/tests/typecheck/should_fail/T15962.stderr index a6f4034277..912ac13c42 100644 --- a/testsuite/tests/typecheck/should_fail/T15962.stderr +++ b/testsuite/tests/typecheck/should_fail/T15962.stderr @@ -15,4 +15,4 @@ T15962.hs:28:11: error: [GHC-88464] (bound at T15962.hs:28:1) T15962.hs:34:12: error: [GHC-88464] - Variable not in scope: iDontExist :: Big ('Conjunction : ks) + Variable not in scope: iDontExist :: Big (Conjunction : ks) diff --git a/testsuite/tests/typecheck/should_fail/T16829a.stderr b/testsuite/tests/typecheck/should_fail/T16829a.stderr index f98154f9d0..8634344108 100644 --- a/testsuite/tests/typecheck/should_fail/T16829a.stderr +++ b/testsuite/tests/typecheck/should_fail/T16829a.stderr @@ -1,5 +1,5 @@ T16829a.hs:9:1: error: [GHC-55233] - • Newtype has non-* return kind ‘TYPE 'IntRep’ + • Newtype has non-* return kind ‘TYPE IntRep’ • In the newtype declaration for ‘T’ Suggested fix: Perhaps you intended to use UnliftedNewtypes diff --git a/testsuite/tests/typecheck/should_fail/T16829b.stderr b/testsuite/tests/typecheck/should_fail/T16829b.stderr index 9aad973311..711a2c7951 100644 --- a/testsuite/tests/typecheck/should_fail/T16829b.stderr +++ b/testsuite/tests/typecheck/should_fail/T16829b.stderr @@ -1,5 +1,5 @@ T16829b.hs:10:1: error: [GHC-55233] - • Newtype instance has non-* return kind ‘TYPE 'IntRep’ + • Newtype instance has non-* return kind ‘TYPE IntRep’ • In the newtype instance declaration for ‘T’ Suggested fix: Perhaps you intended to use UnliftedNewtypes diff --git a/testsuite/tests/typecheck/should_fail/T17301.stderr b/testsuite/tests/typecheck/should_fail/T17301.stderr index 7c7e20f005..4c1c693bc1 100644 --- a/testsuite/tests/typecheck/should_fail/T17301.stderr +++ b/testsuite/tests/typecheck/should_fail/T17301.stderr @@ -1,5 +1,5 @@ T17301.hs:22:3: error: • Uninferrable type variable (a0 :: A) in - type family equation right-hand side: 'MkATySing @(B a0) ('SB @a0) + type family equation right-hand side: MkATySing @(B a0) (SB @a0) • In the type family declaration for ‘Forget’ diff --git a/testsuite/tests/typecheck/should_fail/T21327.stderr b/testsuite/tests/typecheck/should_fail/T21327.stderr index 98ea237018..1a82cd95f3 100644 --- a/testsuite/tests/typecheck/should_fail/T21327.stderr +++ b/testsuite/tests/typecheck/should_fail/T21327.stderr @@ -3,6 +3,6 @@ T21327.hs:7:11: error: [GHC-18872] • Couldn't match a lifted type with an unlifted type When matching types t0 :: * - Int# :: TYPE 'IntRep + Int# :: TYPE IntRep • In the expression: ?p :: Int# In an equation for ‘foo’: foo () = (?p :: Int#) diff --git a/testsuite/tests/typecheck/should_fail/T6018fail.stderr b/testsuite/tests/typecheck/should_fail/T6018fail.stderr index 4171226794..0c352199e1 100644 --- a/testsuite/tests/typecheck/should_fail/T6018fail.stderr +++ b/testsuite/tests/typecheck/should_fail/T6018fail.stderr @@ -24,14 +24,14 @@ T6018fail.hs:30:15: error: [GHC-05175] T6018fail.hs:38:15: error: [GHC-05175] Type family equation violates the family's injectivity annotation. RHS of injective type family equation is a bare type variable - but these LHS type and kind patterns are not bare variables: ‘'Z’ - P 'Z m = m -- Defined at T6018fail.hs:38:15 + but these LHS type and kind patterns are not bare variables: ‘Z’ + P Z m = m -- Defined at T6018fail.hs:38:15 T6018fail.hs:39:15: error: [GHC-05175] Type family equation right-hand sides overlap; this violates the family's injectivity annotation: - P ('S n) m = 'S (P n m) -- Defined at T6018fail.hs:39:15 - P 'Z m = m -- Defined at T6018fail.hs:38:15 + P (S n) m = S (P n m) -- Defined at T6018fail.hs:39:15 + P Z m = m -- Defined at T6018fail.hs:38:15 T6018fail.hs:44:15: error: [GHC-05175] Type family equation violates the family's injectivity annotation. @@ -43,7 +43,7 @@ T6018fail.hs:48:15: error: [GHC-05175] Type family equation violates the family's injectivity annotation. Type variable ‘n’ cannot be inferred from the right-hand side. In the type family equation: - K ('S n) m = 'S m -- Defined at T6018fail.hs:48:15 + K (S n) m = S m -- Defined at T6018fail.hs:48:15 T6018fail.hs:53:15: error: [GHC-05175] Type family equation violates the family's injectivity annotation. diff --git a/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr b/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr index b7f9b3fd63..9ebad2c55f 100644 --- a/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr +++ b/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr @@ -9,8 +9,8 @@ T6018failclosed.hs:11:5: error: [GHC-05175] T6018failclosed.hs:19:5: error: [GHC-05175] • Type family equation right-hand sides overlap; this violates the family's injectivity annotation: - PClosed 'Z m = m -- Defined at T6018failclosed.hs:19:5 - PClosed ('S n) m = 'S (PClosed n m) + PClosed Z m = m -- Defined at T6018failclosed.hs:19:5 + PClosed (S n) m = S (PClosed n m) -- Defined at T6018failclosed.hs:20:5 • In the equations for closed type family ‘PClosed’ In the type family declaration for ‘PClosed’ @@ -18,8 +18,8 @@ T6018failclosed.hs:19:5: error: [GHC-05175] T6018failclosed.hs:19:5: error: [GHC-05175] • Type family equation violates the family's injectivity annotation. RHS of injective type family equation is a bare type variable - but these LHS type and kind patterns are not bare variables: ‘'Z’ - PClosed 'Z m = m -- Defined at T6018failclosed.hs:19:5 + but these LHS type and kind patterns are not bare variables: ‘Z’ + PClosed Z m = m -- Defined at T6018failclosed.hs:19:5 • In the equations for closed type family ‘PClosed’ In the type family declaration for ‘PClosed’ @@ -38,7 +38,7 @@ T6018failclosed.hs:30:5: error: [GHC-05175] • Type family equation violates the family's injectivity annotation. Type variable ‘n’ cannot be inferred from the right-hand side. In the type family equation: - KClosed ('S n) m = 'S m -- Defined at T6018failclosed.hs:30:5 + KClosed (S n) m = S m -- Defined at T6018failclosed.hs:30:5 • In the equations for closed type family ‘KClosed’ In the type family declaration for ‘KClosed’ @@ -69,8 +69,8 @@ T6018failclosed.hs:43:5: error: [GHC-05175] T6018failclosed.hs:49:3: error: [GHC-05175] • Type family equation right-hand sides overlap; this violates the family's injectivity annotation: - E2 'True = 'False -- Defined at T6018failclosed.hs:49:3 - E2 a = 'False -- Defined at T6018failclosed.hs:50:3 + E2 True = False -- Defined at T6018failclosed.hs:49:3 + E2 a = False -- Defined at T6018failclosed.hs:50:3 • In the equations for closed type family ‘E2’ In the type family declaration for ‘E2’ @@ -78,7 +78,7 @@ T6018failclosed.hs:50:3: error: [GHC-05175] • Type family equation violates the family's injectivity annotation. Type variable ‘a’ cannot be inferred from the right-hand side. In the type family equation: - E2 a = 'False -- Defined at T6018failclosed.hs:50:3 + E2 a = False -- Defined at T6018failclosed.hs:50:3 • In the equations for closed type family ‘E2’ In the type family declaration for ‘E2’ diff --git a/testsuite/tests/typecheck/should_fail/T8262.stderr b/testsuite/tests/typecheck/should_fail/T8262.stderr index c9baa5315a..c6798595ea 100644 --- a/testsuite/tests/typecheck/should_fail/T8262.stderr +++ b/testsuite/tests/typecheck/should_fail/T8262.stderr @@ -3,7 +3,7 @@ T8262.hs:5:15: error: [GHC-18872] • Couldn't match a lifted type with an unlifted type When matching types a :: * - GHC.Prim.Int# :: TYPE 'GHC.Types.IntRep + GHC.Prim.Int# :: TYPE GHC.Types.IntRep • In the first argument of ‘Just’, namely ‘(1#)’ In the expression: Just (1#) In an equation for ‘foo’: foo x = Just (1#) diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr index e1b4b5e461..6f932839bd 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr @@ -1,10 +1,10 @@ UnliftedNewtypesInfinite.hs:9:20: error: [GHC-27958] • Couldn't match kind ‘t0’ - with ‘'GHC.Types.TupleRep '[ 'GHC.Types.IntRep, t0]’ + with ‘GHC.Types.TupleRep [GHC.Types.IntRep, t0]’ Expected kind ‘TYPE t0’, but ‘(# Int#, Foo #)’ has kind ‘TYPE - ('GHC.Types.TupleRep '[ 'GHC.Types.IntRep, t0])’ + (GHC.Types.TupleRep [GHC.Types.IntRep, t0])’ • In the type ‘(# Int#, Foo #)’ In the definition of data constructor ‘FooC’ In the newtype declaration for ‘Foo’ diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesNotEnabled.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesNotEnabled.stderr index a4bd2f9980..27652f03fa 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesNotEnabled.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesNotEnabled.stderr @@ -1,5 +1,5 @@ UnliftedNewtypesNotEnabled.hs:9:1: error: [GHC-55233] - • Newtype has non-* return kind ‘TYPE 'GHC.Types.IntRep’ + • Newtype has non-* return kind ‘TYPE GHC.Types.IntRep’ • In the newtype declaration for ‘Baz’ Suggested fix: Perhaps you intended to use UnliftedNewtypes diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr index 546b8537a0..bbcfd0f303 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr @@ -1,7 +1,7 @@ UnliftedNewtypesUnassociatedFamilyFail.hs:21:30: error: [GHC-25897] - • Couldn't match kind ‘t’ with ‘'IntRep’ - Expected a type, but ‘Int#’ has kind ‘TYPE 'IntRep’ + • Couldn't match kind ‘t’ with ‘IntRep’ + Expected a type, but ‘Int#’ has kind ‘TYPE IntRep’ ‘t’ is a rigid type variable bound by a family instance declaration at UnliftedNewtypesUnassociatedFamilyFail.hs:21:1-33 @@ -10,8 +10,8 @@ UnliftedNewtypesUnassociatedFamilyFail.hs:21:30: error: [GHC-25897] In the newtype instance declaration for ‘DF’ UnliftedNewtypesUnassociatedFamilyFail.hs:22:30: error: [GHC-25897] - • Couldn't match kind ‘t’ with ‘'WordRep’ - Expected a type, but ‘Word#’ has kind ‘TYPE 'WordRep’ + • Couldn't match kind ‘t’ with ‘WordRep’ + Expected a type, but ‘Word#’ has kind ‘TYPE WordRep’ ‘t’ is a rigid type variable bound by a family instance declaration at UnliftedNewtypesUnassociatedFamilyFail.hs:22:1-34 @@ -20,10 +20,10 @@ UnliftedNewtypesUnassociatedFamilyFail.hs:22:30: error: [GHC-25897] In the newtype instance declaration for ‘DF’ UnliftedNewtypesUnassociatedFamilyFail.hs:23:30: error: [GHC-25897] - • Couldn't match kind ‘t’ with ‘'TupleRep '[ 'IntRep, 'WordRep]’ + • Couldn't match kind ‘t’ with ‘TupleRep [IntRep, WordRep]’ Expected a type, but ‘(# Int#, Word# #)’ has kind ‘TYPE - ('TupleRep '[ 'IntRep, 'WordRep])’ + (TupleRep [IntRep, WordRep])’ ‘t’ is a rigid type variable bound by a family instance declaration at UnliftedNewtypesUnassociatedFamilyFail.hs:23:1-46 diff --git a/testsuite/tests/typecheck/should_fail/tcfail079.stderr b/testsuite/tests/typecheck/should_fail/tcfail079.stderr index a5c82e99f9..b9e7a8390f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail079.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail079.stderr @@ -1,5 +1,5 @@ tcfail079.hs:9:1: error: [GHC-55233] - • Newtype has non-* return kind ‘TYPE 'GHC.Types.IntRep’ + • Newtype has non-* return kind ‘TYPE GHC.Types.IntRep’ • In the newtype declaration for ‘Unboxed’ Suggested fix: Perhaps you intended to use UnliftedNewtypes diff --git a/testsuite/tests/typecheck/should_fail/tcfail123.stderr b/testsuite/tests/typecheck/should_fail/tcfail123.stderr index 19c611b55a..97e99a2ab4 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail123.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail123.stderr @@ -3,7 +3,7 @@ tcfail123.hs:11:9: error: [GHC-18872] • Couldn't match a lifted type with an unlifted type When matching types p0 :: * - GHC.Prim.Int# :: TYPE 'GHC.Types.IntRep + GHC.Prim.Int# :: TYPE GHC.Types.IntRep • In the first argument of ‘f’, namely ‘3#’ In the expression: f 3# In an equation for ‘h’: h v = f 3# diff --git a/testsuite/tests/typecheck/should_fail/tcfail159.stderr b/testsuite/tests/typecheck/should_fail/tcfail159.stderr index c6b64cde1e..bb4f0b7dd2 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail159.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail159.stderr @@ -3,7 +3,7 @@ tcfail159.hs:9:11: error: [GHC-83865] • Couldn't match a lifted type with an unlifted type Expected: * Actual: TYPE - ('GHC.Types.TupleRep '[GHC.Types.LiftedRep, GHC.Types.LiftedRep]) + (GHC.Types.TupleRep [GHC.Types.LiftedRep, GHC.Types.LiftedRep]) • In the pattern: ~(# p, q #) In a case alternative: ~(# p, q #) -> p In the expression: case h x of ~(# p, q #) -> p diff --git a/testsuite/tests/typecheck/should_fail/tcfail200.stderr b/testsuite/tests/typecheck/should_fail/tcfail200.stderr index fb92433276..c0e86d2078 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail200.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail200.stderr @@ -3,7 +3,7 @@ tcfail200.hs:5:15: error: [GHC-18872] • Couldn't match a lifted type with an unlifted type When matching types a1 :: * - GHC.Prim.Int# :: TYPE 'GHC.Types.IntRep + GHC.Prim.Int# :: TYPE GHC.Types.IntRep • In the expression: 1# In the expression: (1#, 'c') In an equation for ‘x’: x = (1#, 'c') |