From 13d627bbd0bc3dd30d672de341aa7f471be0aa2c Mon Sep 17 00:00:00 2001 From: Vladislav Zavialov Date: Fri, 18 Nov 2022 12:53:00 +0300 Subject: 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 --- testsuite/tests/patsyn/should_fail/T15695.stderr | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'testsuite/tests/patsyn') diff --git a/testsuite/tests/patsyn/should_fail/T15695.stderr b/testsuite/tests/patsyn/should_fail/T15695.stderr index 6753d8bb9c..f7f065b024 100644 --- a/testsuite/tests/patsyn/should_fail/T15695.stderr +++ b/testsuite/tests/patsyn/should_fail/T15695.stderr @@ -1,27 +1,27 @@ T15695.hs:40:14: warning: [GHC-25897] [-Wdeferred-type-errors (in -Wdefault)] - • Could not deduce ‘a2 ~ NA 'VO’ + • Could not deduce ‘a2 ~ NA VO’ from the context: ((* -> * -> *) ~ (k -> k1 -> *), Either ~~ f, - ctx ~~ (a2 ':&: (a3 ':&: 'E)), f a2 ~~ f1, f1 a3 ~~ a4) + ctx ~~ (a2 :&: (a3 :&: E)), f a2 ~~ f1, f1 a3 ~~ a4) bound by a pattern with pattern synonym: ASSO :: forall kind (a :: kind) (b :: Ctx kind). () => forall ks k (f :: k -> ks) (a1 :: k) ks1 k1 (f1 :: k1 -> ks1) (a2 :: k1) a3. - (kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 ':&: (a2 ':&: 'E)), + (kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 :&: (a2 :&: E)), f a1 ~~ f1, f1 a2 ~~ a3) => a3 -> ApplyT kind a b, in an equation for ‘from'’ at T15695.hs:40:8-21 Expected: a4 - Actual: Either (NA 'VO) a3 + Actual: Either (NA VO) a3 ‘a2’ is a rigid type variable bound by a pattern with pattern synonym: ASSO :: forall kind (a :: kind) (b :: Ctx kind). () => forall ks k (f :: k -> ks) (a1 :: k) ks1 k1 (f1 :: k1 -> ks1) (a2 :: k1) a3. - (kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 ':&: (a2 ':&: 'E)), + (kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 :&: (a2 :&: E)), f a1 ~~ f1, f1 a2 ~~ a3) => a3 -> ApplyT kind a b, in an equation for ‘from'’ @@ -30,7 +30,7 @@ T15695.hs:40:14: warning: [GHC-25897] [-Wdeferred-type-errors (in -Wdefault)] In the pattern: ASSO (Left a) In an equation for ‘from'’: from' (ASSO (Left a)) = Here (a :* Nil) • Relevant bindings include - from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[ 'VO]] + from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[VO]] (bound at T15695.hs:40:1) T15695.hs:41:33: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] @@ -43,5 +43,5 @@ T15695.hs:41:33: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)] In an equation for ‘from'’: from' (ASSO (Right b)) = There (Here undefined) • Relevant bindings include - from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[ 'VO]] + from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[VO]] (bound at T15695.hs:40:1) -- cgit v1.2.1