Skip to content
  • Daniel Rogozin's avatar
    Fall back to types when looking up data constructors (#18740) · 990ea991
    Daniel Rogozin authored
    Before this patch, referring to a data constructor in a term-level
    context led to a scoping error:
    
        ghci> id Int
        <interactive>:1:4: error: Data constructor not in scope: Int
    
    After this patch, the renamer falls back to the type namespace
    and successfully finds the Int. It is then rejected in the type
    checker with a more useful error message:
    
        <interactive>:1:4: error:
        • Illegal term-level use of the type constructor ‘Int’
            imported from ‘Prelude’ (and originally defined in ‘GHC.Types’)
        • In the first argument of ‘id’, namely ‘Int’
          In the expression: id Int
    
    We also do this for type variables.
    990ea991