diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-28 16:54:11 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-28 16:54:11 -0500 |
commit | bc42e2b03a87e3f6c0d24584382f281c6580801b (patch) | |
tree | 0a0ed4f857991902ab1b076e7b8ef1a6ba2433cb /compiler | |
parent | de78ee6fb77e7505160ab23e6e1b4e66dc87f698 (diff) | |
download | haskell-bc42e2b03a87e3f6c0d24584382f281c6580801b.tar.gz |
Convert pprTrace in isPredTy to a WARN
Summary:
There was a `pprTrace` in `isPredTy` that could fire under certain
scenarios, causing normal GHC users to see debugging output. This turns it into
a less chatty `WARN`, and expounds on the comment below it to add the scenario
in #13187 which triggered the `pprTrace`.
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3033
GHC Trac Issues: #13187
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/types/Type.hs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index b61178665f..ad1b11f625 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1525,12 +1525,26 @@ isPredTy ty = go ty [] go_k k [] = isConstraintKind k go_k k (arg:args) = case piResultTy_maybe k arg of Just k' -> go_k k' args - Nothing -> pprTrace "isPredTy" (ppr ty) + Nothing -> WARN( True, text "isPredTy" <+> ppr ty ) False - -- This last case should not happen; but it does if we - -- we call isPredTy during kind checking, especially if - -- there is actually a kind error. Example that showed - -- this up: polykinds/T11399 + -- This last case shouldn't happen under most circumstances. It can + -- occur if we call isPredTy during kind checking, especially if one + -- of the following happens: + -- + -- 1. There is actually a kind error. Example in which this showed up: + -- polykinds/T11399 + -- 2. A type constructor application appears to be oversaturated. An + -- example of this occurred in GHC Trac #13187: + -- + -- {-# LANGUAGE PolyKinds #-} + -- type Const a b = b + -- f :: Const Int (,) Bool Char -> Char + -- + -- This code is actually fine, since Const is polymorphic in its + -- return kind. It does show that isPredTy could possibly report a + -- false negative if a constraint is similarly oversaturated, but + -- it's hard to do better than isPredTy currently does without + -- zonking, so we punt on such cases for now. isClassPred, isEqPred, isNomEqPred, isIPPred :: PredType -> Bool isClassPred ty = case tyConAppTyCon_maybe ty of |