[GHC] #15220: ScopedTypeVariables binds a non-existent variable
GHC
ghc-devs at haskell.org
Sun Jun 3 13:47:21 UTC 2018
#15220: ScopedTypeVariables binds a non-existent variable
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.5
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
GHC accepts this definition:
{{{#!hs
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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15220>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list