[commit: ghc] master: Remove hack put in place for #12512 (9cb289a)
git at git.haskell.org
git at git.haskell.org
Thu Dec 21 00:44:27 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/9cb289abc582c9eb8337a2621baf58e35feeff46/ghc
>---------------------------------------------------------------
commit 9cb289abc582c9eb8337a2621baf58e35feeff46
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Wed Dec 20 19:25:37 2017 -0500
Remove hack put in place for #12512
Summary:
Previously, I added an ad hoc check for unboxed tuples and
sums in standalone-derived instances to fix #12512, under the
pretense that polymorphism over `UnboxedTupleRep` and
`UnboxedSumRep` was a lie. But that is no longer the case, and so
this ad hoc check can be removed entirely. Less code, and easier to
understand.
Test Plan: make test TEST=T12512
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4271
>---------------------------------------------------------------
9cb289abc582c9eb8337a2621baf58e35feeff46
compiler/typecheck/TcDeriv.hs | 12 +-----------
testsuite/tests/deriving/should_fail/T12512.stderr | 6 ++++--
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs
index 33ce581..f0ddce0 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/typecheck/TcDeriv.hs
@@ -638,12 +638,6 @@ deriveStandalone (L loc (DerivDecl deriv_ty deriv_strat' overlap_mode))
-> do warnUselessTypeable
return Nothing
- | isUnboxedTupleTyCon tc
- -> bale_out $ unboxedTyConErr "tuple"
-
- | isUnboxedSumTyCon tc
- -> bale_out $ unboxedTyConErr "sum"
-
| isAlgTyCon tc || isDataFamilyTyCon tc -- All other classes
-> do { spec <- mkEqnHelp (fmap unLoc overlap_mode)
tvs cls cls_tys tc tc_args
@@ -973,7 +967,7 @@ mkEqnHelp overlap_mode tvs cls cls_tys tycon tc_args mtheta deriv_strat
, denv_mtheta = mtheta
, denv_strat = deriv_strat }
; flip runReaderT deriv_env $
- if isDataTyCon rep_tc then mkDataTypeEqn else mkNewTypeEqn }
+ if isNewTyCon rep_tc then mkNewTypeEqn else mkDataTypeEqn }
where
bale_out msg = failWithTc (derivingThingErr False cls cls_tys
(mkTyConApp tycon tc_args) deriv_strat msg)
@@ -1932,7 +1926,3 @@ derivingHiddenErr tc
standaloneCtxt :: LHsSigType GhcRn -> SDoc
standaloneCtxt ty = hang (text "In the stand-alone deriving instance for")
2 (quotes (ppr ty))
-
-unboxedTyConErr :: String -> MsgDoc
-unboxedTyConErr thing =
- text "The last argument of the instance cannot be an unboxed" <+> text thing
diff --git a/testsuite/tests/deriving/should_fail/T12512.stderr b/testsuite/tests/deriving/should_fail/T12512.stderr
index a62cda6..78c49f4 100644
--- a/testsuite/tests/deriving/should_fail/T12512.stderr
+++ b/testsuite/tests/deriving/should_fail/T12512.stderr
@@ -1,10 +1,12 @@
T12512.hs:10:1: error:
• Can't make a derived instance of ‘Wat1 (# a, b #)’:
- The last argument of the instance cannot be an unboxed tuple
+ ‘Wat1’ is not a stock derivable class (Eq, Show, etc.)
+ Try enabling DeriveAnyClass
• In the stand-alone deriving instance for ‘Wat1 (# a, b #)’
T12512.hs:13:1: error:
• Can't make a derived instance of ‘Wat2 (# a | b #)’:
- The last argument of the instance cannot be an unboxed sum
+ ‘Wat2’ is not a stock derivable class (Eq, Show, etc.)
+ Try enabling DeriveAnyClass
• In the stand-alone deriving instance for ‘Wat2 (# a | b #)’
More information about the ghc-commits
mailing list