[GHC] #12092: Out-of-scope variable leads to type error, not scope error

GHC ghc-devs at haskell.org
Thu Jan 31 16:26:31 UTC 2019


#12092: Out-of-scope variable leads to type error, not scope error
-------------------------------------+-------------------------------------
        Reporter:  kwf               |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:
      Resolution:  fixed             |  TypeApplications
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13834            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dbaynard):

 I'm seeing this on 8.6.3 (even with `-fno-defer-type-errors`). Note: my
 ghc install is managed by stack.

 == Without application

 {{{
 > cat type-app-err.hs
 {-# LANGUAGE TypeApplications #-}

 module Bug where

 huh = spam

 > ghc -fno-defer-type-errors type-app-err
  16:19:10
 [1 of 1] Compiling Bug              ( type-app-err.hs, type-app-err.o )

 type-app-err.hs:5:7: error:
     • Variable not in scope: spam
     • Perhaps you meant ‘span’ (imported from Prelude)
   |
 5 | huh = spam
   |       ^^^^
 }}}

 == Without application

 {{{
 > cat type-app-err.hs
 {-# LANGUAGE TypeApplications #-}

 module Bug where

 huh = spam @Int

 > ghc -fno-defer-type-errors type-app-err
  16:19:18
 [1 of 1] Compiling Bug              ( type-app-err.hs, type-app-err.o )

 type-app-err.hs:5:7: error:
     • Cannot apply expression of type ‘t1’
       to a visible type argument ‘Int’
     • In the expression: spam @Int
       In an equation for ‘huh’: huh = spam @Int
   |
 5 | huh = spam @Int
   |       ^^^^^^^^^
 }}}

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


More information about the ghc-tickets mailing list