Commit f8563838 authored by thomasw's avatar thomasw Committed by Ben Gamari

Fix Trac #10519

Look through nested foralls when checking the validity of a partial type
signature. The combination of D836 and D613 prompts this change.

Test Plan: The test T10519 must pass

Reviewers: simonpj, alanz, austin

Reviewed By: simonpj, alanz, austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D994

GHC Trac Issues: #10519
parent 1d6ead7d
...@@ -554,7 +554,7 @@ rnLHsTypeWithWildCards doc ty ...@@ -554,7 +554,7 @@ rnLHsTypeWithWildCards doc ty
= do { -- When there is a wild card at the end of the context, remove it and = do { -- When there is a wild card at the end of the context, remove it and
-- add its location as the extra-constraints wild card in the -- add its location as the extra-constraints wild card in the
-- HsForAllTy. -- HsForAllTy.
let ty' = extractExtraCtsWc `fmap` ty let ty' = extractExtraCtsWc `fmap` flattenTopLevelLHsForAllTy ty
; checkValidPartialType doc ty' ; checkValidPartialType doc ty'
......
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE PartialTypeSignatures #-}
module T10519 where
foo :: forall a. _ => a -> a -> Bool
foo x y = x == y
T10519.hs:5:18: warning:
Found hole ‘_’ with inferred constraints: Eq a
In the type signature for ‘foo’: _ => a -> a -> Bool
...@@ -48,3 +48,4 @@ test('UncurryNamed', normal, compile, ['-ddump-types -fno-warn-partial-type-sign ...@@ -48,3 +48,4 @@ test('UncurryNamed', normal, compile, ['-ddump-types -fno-warn-partial-type-sign
test('WarningWildcardInstantiations', normal, compile, ['-ddump-types']) test('WarningWildcardInstantiations', normal, compile, ['-ddump-types'])
test('T10403', normal, compile, ['']) test('T10403', normal, compile, [''])
test('T10438', normal, compile, ['']) test('T10438', normal, compile, [''])
test('T10519', normal, compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment