[GHC] #11066: Inacessible branch should be warning - otherwise breaks type soundness?

GHC ghc-devs at haskell.org
Mon May 14 14:46:21 UTC 2018


#11066: Inacessible branch should be warning - otherwise breaks type soundness?
-------------------------------------+-------------------------------------
        Reporter:  rrnewton          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #8128, #8740      |  Differential Rev(s):  Phab:D1454
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by tdammers):

 The following patch turns the "Inaccessible" error into a warning:

 {{{
 commit f4f9c0fc9564f17339718378e9fea3bd186fff96
 Author: Tobias Dammers <tdammers at gmail.com>
 Date:   Tue May 8 13:54:28 2018 +0200

     [WIP] turn "inaccessible code" error into a warning

     (#11066)

 diff --git a/compiler/typecheck/TcErrors.hs
 b/compiler/typecheck/TcErrors.hs
 index dde7c3c75a..2d3af68008 100644
 --- a/compiler/typecheck/TcErrors.hs
 +++ b/compiler/typecheck/TcErrors.hs
 @@ -708,7 +708,7 @@ mkGivenErrorReporter implic ctxt cts
                               Nothing ty1 ty2

         ; traceTc "mkGivenErrorReporter" (ppr ct)
 -       ; maybeReportError ctxt err }
 +       ; reportWarning NoReason err }
    where
      (ct : _ )  = cts    -- Never empty
      (ty1, ty2) = getEqPredTys (ctPred ct)
 }}}

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


More information about the ghc-tickets mailing list