Skip to content

Fix validity checking for inferred types

Simon Peyton Jones requested to merge wip/T17213 into master

GHC is suposed to uphold the principle that an /inferred/ type for a let-binding should obey the rules for that module. E.g. we should only accept an inferred higher rank type if we have RankNTypes on.

But we were failing to check this: TcValidity.checkValidType allowed arbitrary rank for inferred types.

This patch fixes the bug. It might in principle cause some breakage, but if so that's good: the user should add RankNTypes and/or a manual signature. (And almost every package has explicit user signatures for all top-level things anyway.) Let's see.

Merge request reports