From c50e4c92d28752beec955d1e3486065685d2f7e6 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Fri, 20 Sep 2019 23:26:38 +0100 Subject: Fix validity checking for inferred types 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. Fixes #17213. Metric Decrease: T10370 --- testsuite/tests/typecheck/should_fail/T17213.hs | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 testsuite/tests/typecheck/should_fail/T17213.hs (limited to 'testsuite/tests/typecheck/should_fail/T17213.hs') diff --git a/testsuite/tests/typecheck/should_fail/T17213.hs b/testsuite/tests/typecheck/should_fail/T17213.hs new file mode 100644 index 0000000000..e9c093c903 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17213.hs @@ -0,0 +1,5 @@ +module T17213 where + +import T17213a + +g = foo -- cgit v1.2.1