Opened 4 years ago

Closed 4 years ago

#8806 closed bug (fixed)

Invalid constraints should fail to type check

Reported by: erikd Owned by: erikd
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.6.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_fail/T8806
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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.


g :: (Int => Show a) => Int
g = undefined

Change History (2)

comment:1 Changed 4 years ago by Erik de Castro Lopo <erikd@…>

In 55cc01a95328667e5e26f1e3062a45059cc3cbec/ghc:

Add test case for #8806.

GHC 7.6.3 and earlier should fail to type check this but don't.
This was fixed some time between the 7.6.3 and the 7.8rc1 release, so
we're just adding a test to prevent future regressions.

comment:2 Changed 4 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: typecheck/should_fail/T8806

Thanks Erik. I'm just adding the test case to the ticket, and closing since it's now done (as I understand it).


Note: See TracTickets for help on using tickets.