Skip to content

GHC incorrectly suggests a data constructor is in scope in 8.2

After commit 343cb32d (the fix for #13568 (closed)), which debuted in GHC 8.2, GHC thinks that out-of-scope identifiers are actually in-scope!

module Bug where

f :: T
f = undefined

In GHC 8.2.1-rc3, the error message is:

$ /opt/ghc/8.2.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:3:6: error:
    Not in scope: type constructor or class ‘T’
    A data constructor of that name is in scope; did you mean DataKinds?
  |
3 | f :: T
  |      ^

Compare this to GHC 8.0.2, which gives a more sensible error message:

$ /opt/ghc/8.0.2/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:3:6: error: Not in scope: type constructor or class ‘T’
Trac metadata
Trac field Value
Version 8.2.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC mrkgnao
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information