[GHC] #7827: GHC internal error: `a' is not in scope during type checking, but it passed the renamer

#7827: GHC internal error: `a' is not in scope during type checking, but it passed the renamer --------------------------------------+------------------------------------- Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- In the attached code the following lines give an internal GHC error. At least this should not happen. I also think this is valid code. Removing either type annotation makes this code compile. {{{ bug :: WrappedR Int -> SomeFunction bug (Wrap node) = case node of (Memo' (emptyT :: t a b) memoize (Var m) :: R' a b Int) -> -- also breaks }}} {{{ /Users/alessandro/Documents/Uni/thesis/test/bug-tvar-passed- renamer.hs:14:104: GHC internal error: `a' is not in scope during type checking, but it passed the renamer tcl_env of environment: [(am4, Identifier[node::R' a b Int, <NotTopLevel>, 1]), (rgs, Identifier[bug::WrappedR Int -> SomeFunction, <NotTopLevel>, 1])] In the type `R' a b Int' In a pattern type signature: R' a b Int In the pattern: Memo' (emptyT :: t a b) (memoize :: MVar (t a b) -> (a -> b) -> a -> b) (Var m :: R' a b Int) :: R' a b Int }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7827 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7827: GHC internal error: `a' is not in scope during type checking, but it passed the renamer --------------------------------------+------------------------------------- Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- Changes (by xnyhps): * cc: thijsalkemade@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7827#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7827: GHC internal error: `a' is not in scope during type checking, but it passed the renamer --------------------------------------+------------------------------------- Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- Changes (by AlessandroVermeulen): * cc: haskell@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7827#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7827: GHC internal error: `a' is not in scope during type checking, but it passed the renamer --------------------------------------+------------------------------------- Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- Comment(by monoidal): Here's a smaller version. {{{ {-# LANGUAGE ScopedTypeVariables #-} module Main where bug :: a -> Int bug ((x :: a) :: a) = undefined }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7827#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7827: GHC internal error: `a' is not in scope during type checking, but it passed the renamer --------------------------------------+------------------------------------- Reporter: guest | Owner: Type: bug | Status: patch Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- Changes (by parcs): * status: new => patch Comment: I've attached a patch (comments included) that fixes this issue (correctly, I hope). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7827#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7827: GHC internal error: `a' is not in scope during type checking, but it passed
the renamer
--------------------------------------+-------------------------------------
Reporter: guest | Owner:
Type: bug | Status: patch
Priority: normal | Component: Compiler
Version: 7.6.2 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: GHC rejects valid program | Blockedby:
Blocking: | Related:
--------------------------------------+-------------------------------------
Comment(by patrick@…):
commit 37be6f06feed7351336bf8301fab93ac7c4d3a12
{{{
Author: Patrick Palka

#7827: GHC internal error: `a' is not in scope during type checking, but it passed the renamer ---------------------------------------------+------------------------------ Reporter: guest | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.2 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Difficulty: Unknown Testcase: typecheck/should_compile/T7827 | Blockedby: Blocking: | Related: ---------------------------------------------+------------------------------ Changes (by simonpj): * status: patch => closed * difficulty: => Unknown * resolution: => fixed * testcase: => typecheck/should_compile/T7827 Comment: Your fix looks exactly right, thank you! I've committed it and the test. Much obliged. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7827#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC