From: simonpj@microsoft.com Date: Tue, 26 Oct 2010 07:04:05 +0000 (+0000) Subject: Make isIrrefutableHsPat say True for existentials; fixes Trac #4439 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=cbe382d4ff5a37d38a56aa346b9d229d336f16b4;ds=sidebyside Make isIrrefutableHsPat say True for existentials; fixes Trac #4439 At last. A bug that is really easy to fix. --- diff --git a/compiler/hsSyn/HsPat.lhs b/compiler/hsSyn/HsPat.lhs index 1bf0aa8..25a350b 100644 --- a/compiler/hsSyn/HsPat.lhs +++ b/compiler/hsSyn/HsPat.lhs @@ -47,6 +47,7 @@ import SrcLoc import FastString -- libraries: import Data.Data hiding (TyCon) +import Data.Maybe \end{code} @@ -411,7 +412,9 @@ isIrrefutableHsPat pat go1 (ConPatIn {}) = False -- Conservative go1 (ConPatOut{ pat_con = L _ con, pat_args = details }) - = isProductTyCon (dataConTyCon con) + = isJust (tyConSingleDataCon_maybe (dataConTyCon con)) + -- NB: tyConSingleDataCon_maybe, *not* isProductTyCon, because + -- the latter is false of existentials. See Trac #4439 && all go (hsConPatArgs details) go1 (LitPat {}) = False