[GHC] #14498: GHC internal error: "not in scope during TC but it passed the renamer"
GHC
ghc-devs at haskell.org
Thu Nov 30 15:44:08 UTC 2017
#14498: GHC internal error: "not in scope during TC but it passed the renamer"
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.2.1
checker) | Keywords:
Resolution: | PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: #14288 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
To be clear here: I'm not proposing to change anything regarding the rules
for ordinary functions (I'll save that for #14288, which will require a
GHC proposal). I'm only proposing to change the rules for pattern
synonyms, since (1) pattern synonyms are a more experimental feature, and
(2) the current rules governing them are clearly broken, as this ticket
demonstrates.
Replying to [comment:8 simonpj]:
> 1. Where are the implicitly-added foralls? Example
> {{{
> pattern SS ::
> forall (t :: k').
> ()
> => forall (a :: kk -> k') (n :: kk).
> (t ~ a n)
> => blah
> }}}
> This is short for
> {{{
> pattern SS ::
> forall {k'}. forall (t :: k').
> ()
> => forall {kk}. forall (a :: kk -> k') (n :: kk).
> (t ~ a n)
> => blah
> }}}
Ideally, this would be the case. The typechecker thinks this way, but
unfortunately, the renamer does not. It thinks it's this:
{{{#!hs
pattern SS ::
forall {k' kk}. forall (t :: k').
()
=> forall (a :: kk -> k') (n :: kk).
(t ~ a n)
=> blah
}}}
That is, the renamer believes everything implicitly quantified is put up
front, as as a result, tries to bring `kk` into scope over the body of
`SS`, leading to the internal error seen above.
I propose to simply not bring `kk` into scope in the renamer. That's all.
(I tried implementing this last week, but this turns out to be quite
tricky, so I gave up.)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14498#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list