Skip to content

ScopedTypeVariables binds a non-existent variable

GHC accepts this definition:

f :: (forall a. a -> a) -> ()
f (x :: b -> b) = x (undefined :: b) `seq` ()

If a scoped type variable is bound always to a variable, then what variable is b bound to? In the desugared Core, it looks like b is bound to Any. Note that I couldn't find any valid argument for x here other than undefined.

I think this definition should be rejected.

In terms of implementation, the zonkTcTypeToType function should never encounter a unfilled-in SigTv. If it does, error. I don't like putting the error there, but I'm not sure I know another place to do it.

Trac metadata
Trac field Value
Version 8.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information