[GHC] #14339: GHC 8.2.1 regression when combining GND with TypeError (solveDerivEqns: probable loop)
GHC
ghc-devs at haskell.org
Tue Oct 10 22:41:16 UTC 2017
#14339: GHC 8.2.1 regression when combining GND with TypeError (solveDerivEqns:
probable loop)
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: high | Milestone: 8.4.1
Component: Compiler | Version: 8.2.1
(Type checker) |
Keywords: deriving, | Operating System: Unknown/Multiple
CustomTypeErrors |
Architecture: | Type of failure: Compile-time
Unknown/Multiple | crash or panic
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
This code panics on GHC 8.2.1 and later:
{{{#!hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import GHC.TypeLits
newtype Baz = Baz Foo
deriving Bar
newtype Foo = Foo Int
class Bar a where
bar :: a
instance (TypeError (Text "Boo")) => Bar Foo where
bar = undefined
}}}
{{{
$ /opt/ghc/8.2.1/bin/ghci Bug.hs
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.1 for x86_64-unknown-linux):
solveDerivEqns: probable loop
DerivSpec
ds_loc = Bug.hs:9:12-14
ds_name = $fBarBaz
ds_tvs = []
ds_cls = Bar
ds_tys = [Baz]
ds_theta = [ThetaOrigin
to_tvs = []
to_givens = []
to_wanted_origins = [Bar Foo, (Foo :: *) ~R# (Baz ::
*)]]
ds_mechanism = newtype
[[s0_a1D7[fuv:0]]]
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at
compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in
ghc:Outputable
pprPanic, called at compiler/typecheck/TcDerivInfer.hs:515:9 in
ghc:TcDerivInfer
}}}
This is a regression since GHC 8.0.2, in which it does compile
successfully.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14339>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list