[GHC] #12694: GHC HEAD no longer reports inaccessible code

GHC ghc-devs at haskell.org
Thu Oct 13 04:08:29 UTC 2016


#12694: GHC HEAD no longer reports inaccessible code
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           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:
-------------------------------------+-------------------------------------
 Given this A.hs:

 {{{
 {-# LANGUAGE GADTs #-}
 module A where
 f :: Bool ~ Int => a -> b
 f x = x
 }}}

 I get:

 {{{
 ezyang at sabre:~$ ghc-head --version
 The Glorious Glasgow Haskell Compilation System, version 8.1.20161010
 ezyang at sabre:~$ ghc-head --make A.hs
 [1 of 1] Compiling A                ( A.hs, A.o )

 A.hs:4:1: warning: [-Woverlapping-patterns]
     Pattern match is redundant
     In an equation for ‘f’: f x = ...
 }}}

 In contrast:

 {{{
 ezyang at sabre:~$ ghc-8.0 --make A.hs
 [1 of 1] Compiling A                ( A.hs, A.o )

 A.hs:3:6: error:
     • Couldn't match type ‘Bool’ with ‘Int’
       Inaccessible code in
         the type signature for:
           f :: Bool ~ Int => a -> b
     • In the ambiguity check for ‘f’
       To defer the ambiguity check to use sites, enable
 AllowAmbiguousTypes
       In the type signature:
         f :: Bool ~ Int => a -> b
 }}}

 Is this expected? I'd expect at least a warning!

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12694>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list