Commit 800d77e8 authored by Chaitanya Koparkar's avatar Chaitanya Koparkar Committed by Marge Bot

Mention DerivingStrategies in the warning when DAC and GND are both enabled

Summary:

When DeriveAnyClass and GeneralizedNewtypeDeriving are both enabled,
GHC prints out a warning that specifies the strategy it used to
derive a class. This patch updates the warning to mention that users
may pick a particular strategy by using DerivingStrategies.

Test plan: make test TEST=T16179
parent b137ab75
......@@ -1640,7 +1640,10 @@ mkNewTypeEqn
[ text "Both DeriveAnyClass and"
<+> text "GeneralizedNewtypeDeriving are enabled"
, text "Defaulting to the DeriveAnyClass strategy"
<+> text "for instantiating" <+> ppr cls ]
<+> text "for instantiating" <+> ppr cls
, text "Use DerivingStrategies to pick"
<+> text "a different strategy"
]
mk_originative_eqn DerivSpecAnyClass
-- CanDeriveStock
CanDeriveStock gen_fn -> mk_originative_eqn $
......
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module T16179 where
class C a
newtype T a = MkT a deriving C
T16179.hs:7:30: warning:
Both DeriveAnyClass and GeneralizedNewtypeDeriving are enabled
Defaulting to the DeriveAnyClass strategy for instantiating C
Use DerivingStrategies to pick a different strategy
In the newtype declaration for ‘T’
......@@ -114,3 +114,4 @@ test('T15290c', normal, compile, [''])
test('T15290d', normal, compile, [''])
test('T15398', normal, compile, [''])
test('T15637', normal, compile, [''])
test('T16179', normal, compile, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment