[GHC] #14325: Erroneous program emits no errors
GHC
ghc-devs at haskell.org
Thu Oct 5 16:37:49 UTC 2017
#14325: Erroneous program emits no errors
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Consider this (which arose in #14323):
{{{
class (a~b) => C a b
foo :: C a b => a -> b
foo x = x
hm3 :: C (f b) b => b -> f b
hm3 x = foo x
}}}
With GHC 8.2 it compiles without error, but it definitely has a type
error; try `-ddump-simpl`:
{{{
hm3 :: forall (f :: * -> *) b. C (f b) b => b -> f b
[GblId, Arity=2, Str=<L,U><L,U>x]
hm3
= \ (@ (f_a126 :: * -> *))
(@ b_a127)
($dC_a129 :: C (f_a126 b_a127) b_a127)
_ [Occ=Dead] ->
case GHC.Types.HEq_sc
@ *
@ *
@ (f_a126 b_a127)
@ b_a127
($dC_a129
`cast` ((T14323.N:C[0] ; Data.Type.Equality.N:~[0]
<*>_N) <f_a126 b_a127>_N
<b_a127>_N
:: (C (f_a126 b_a127) b_a127 :: Constraint)
~R# ((f_a126 b_a127 :: *) ~~ (b_a127 :: *) ::
Constraint)))
of cobox_a12p
{ __DEFAULT ->
case Control.Exception.Base.typeError
@ 'GHC.Types.LiftedRep
@ (C b_a127 (f_a126 b_a127))
"T14323.hs:28:9: error:\n\
\ \\226\\128\\162 Could not deduce (C b (f b)) arising
from a use of \\226\\128\\152foo\\226\\128\\153\n\
\ from the context: C (f b) b\n\
\ bound by the type signature for:\n\
\ hm3 :: forall (f :: * -> *) b. C (f b) b
=> b -> f b\n\
\ at T14323.hs:27:1-28\n\
\ \\226\\128\\162 In the expression: foo x\n\
\ In an equation for \\226\\128\\152hm3\\226\\128\\153:
hm3 x = foo x\n\
\(deferred type error)"#
of wild_00 {
}
}
}}}
Reason: bug in the error suppression logic in `TcErrors`
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14325>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list