Skip to content

Invalid constraints should fail to type check

With ghc-7.6.3 the following code:

f :: Int => Int
f x = x + 1

should fail to type check, but instead compiles and runs as if it was:

f :: Int -> Int
f x = x + 1

With 7.8rc1 and git HEAD this results in an error:

Expected a constraint, but ‛Int’ has kind ‛*’
In the type signature for ‛f’: f :: Int => Int

We should add a "shouldn't type check" test to avoid the possibilty of a regression.

Also:

g :: (Int => Show a) => Int
g = undefined
Trac metadata
Trac field Value
Version 7.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
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