[GHC] #11520: GHC falls into a hole if given incorrect kind signature

GHC ghc-devs at haskell.org
Mon Feb 1 09:24:30 UTC 2016


#11520: GHC falls into a hole if given incorrect kind signature
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 The trouble here is this:
  * The kind error is indeed found and reported (i.e. collected in the bag
 of errors in the monad)
  * But we continue anyway into `checkValidInstance`
  * The latter calls `fvProv` to check for something like the size of
 instance
  * Which fails because the unsolved constraint has left a hole in the type

 Really we should not even attempt `checkValidInstance` if we fail to kind-
 check the type.

 We could use a `checkNoErrs` in `TcHsTye.TcHsClsInstType`.  But there are
 many other uses of `solveEqualities` all of which in principle have the
 same concern.  So I thought about adding `checkNoErrs` to
 `solveEqualities`.  But there I see
 {{{
 -- | Type-check a thing that emits only equality constraints, then
 -- solve those constraints. Emits errors -- but does not fail --
 -- if there is trouble.
 solveEqualities :: TcM a -> TcM a
 }}}
 '''Richard''': why did you want the "...but does not fail..." bit?  What
 goes wrong if it fais on error?  In effect it always used to!

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


More information about the ghc-tickets mailing list