#10403 closed bug (fixed)
GHC crashes on a partial type signature
Reported by: | Artyom.Kazak | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Compiler | Version: | 7.10.1 |
Keywords: | Cc: | vlad.z.4096@… | |
Operating System: | Linux | Architecture: | x86_64 (amd64) |
Type of failure: | Compile-time crash | Test Case: | partial-sigs/should_compile/T10403 |
Blocked By: | Blocking: | ||
Related Tickets: | Differential Rev(s): | ||
Wiki Page: |
Description (last modified by )
The following code crashes GHC 7.10.1 as is, but doesn't result in a crash if the signature is specified completely or isn't specified at all (inferred):
{-# LANGUAGE PartialTypeSignatures #-} module Main where main :: IO () main = return () data I a = I a instance Functor I where fmap f (I a) = I (f a) newtype B t a = B a instance Functor (B t) where fmap f (B a) = B (f a) newtype H f = H (f ()) app :: H (B t) app = h (H . I) (B ()) h :: _ --h :: Functor m => (a -> b) -> m a -> H m h f b = (H . fmap (const ())) (fmap f b)
Change History (18)
comment:1 Changed 3 years ago by
Cc: | vlad.z.4096@… added |
---|
comment:2 Changed 3 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 3 years ago by
comment:4 Changed 3 years ago by
Error message (in GHCi 7.10.1):
$ ghci GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help Prelude Control.Applicative Control.Monad Data.Ratio> :l Bug.hs [1 of 1] Compiling Main ( Bug.hs, interpreted ) Bug.hs:18:10: Couldn't match type `b' with `H I' `b' is untouchable inside the constraints () bound by the type signature for app :: H (B t) at Bug.hs:17:8-14ghc: panic! (the 'impossible' happened) (GHC version 7.10.1 for x86_64-unknown-linux): No skolem info: b_aFd[sk] Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
comment:5 Changed 3 years ago by
Possibly (most likely?) a duplicate of #10045. Could someone knowledgeable confirm this?
comment:9 Changed 3 years ago by
Resolution: | fixed |
---|---|
Status: | closed → new |
Can the testcase in Simon's Test Trac #10403
commit be changed to how it should be? h :: _ => _
doesn't trigger the bug, only h :: _
does (and I don't know why Simon changed it).
comment:12 Changed 2 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Test Case: | → partial-sigs/should_compile/T10403 |
I've elaborate the test to check both h :: _
and h :: _ => _
.
comment:13 Changed 2 years ago by
Resolution: | fixed |
---|---|
Status: | closed → new |
comment:14 Changed 2 years ago by
Simon, could you please add the code from the ticket to the test suite verbatim? Your new variation does not trigger the bug because you removed the app
function.
Since you want to test both h1 :: _
and h2 :: _ => _
, please do not forget to include add1
and add2
so they get called. Here's code that triggers the bug:
{-# LANGUAGE PartialTypeSignatures #-} module T10403 where main :: IO () main = return () data I a = I a instance Functor I where fmap f (I a) = I (f a) newtype B t a = B a instance Functor (B t) where fmap f (B a) = B (f a) newtype H f = H (f ()) app1 :: H (B t) app1 = h1 (H . I) (B ()) app2 :: H (B t) app2 = h2 (H . I) (B ()) h1 :: _ => _ --h1 :: Functor m => (a -> b) -> m a -> H m h1 f b = (H . fmap (const ())) (fmap f b) h2 :: _ --h2 :: Functor m => (a -> b) -> m a -> H m h2 f b = (H . fmap (const ())) (fmap f b)
The error message I'm getting when loading it in GHCi is:
GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help λ> :l Bug.hs [1 of 1] Compiling T10403 ( Bug.hs, interpreted ) Bug.hs:21:12: Couldn't match type ‘b’ with ‘H I’ ‘b’ is untouchable inside the constraints () bound by the type signature for app2 :: H (B t) at Bug.hs:20:9-15ghc: panic! (the 'impossible' happened) (GHC version 7.10.1 for x86_64-unknown-linux): No skolem info: b_ao6[sk] Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
comment:16 Changed 2 years ago by
OK, I've elaborated the test with the extra pieces you suggest.
It all works fine in HEAD.
It does not work in 7.10; and, as you'll see in #10045, we don't propose to fix in 7.10. I hope you can live without it.
Sound OK?
Simon
comment:17 Changed 2 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:18 Changed 2 years ago by
Yes, it sounds ok. I just wanted to make sure that the bug is known of and reflected in the test suite. Thanks.
Seems to work correctly for HEAD-20150403