Out-of-scope variables not deferred with type constructors
In HEAD, -fdefer-out-of-scope-variables
can no longer defer an out-of-scope identifier if it exists on the type level.
ghci> :set -fdefer-out-of-scope-variables
ghci> x = I
<interactive>:2:5: warning: [-Wdeferred-out-of-scope-variables]
Data constructor not in scope: I
ghci> x = IO
<interactive>:3:5: error:
• Illegal term-level use of the type constructor ‘IO’
imported from ‘Prelude’ (and originally defined in ‘GHC.Types’)
• In the expression: IO
In an equation for ‘x’: x = IO
In 9.0, x = IO
behaves the same as x = I
.
With Dependent Haskell we might ultimately allow x = IO
to mean the type constructor, but the current situation is a bit inconsistent.
Low priority. Related: #17102.