X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcPat.lhs;h=82ac5e3596a53c1558c6800ed3f58f2b7b09a5fd;hb=3d638f1b7b665c0e67e4e20827ad98cf307ff381;hp=e21fb6883e7aa5ae8ca39231eb877e6a95cad996;hpb=a17d329568660592dad5c7668fb09f31ab77cd69;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcPat.lhs b/compiler/typecheck/TcPat.lhs index e21fb68..82ac5e3 100644 --- a/compiler/typecheck/TcPat.lhs +++ b/compiler/typecheck/TcPat.lhs @@ -37,6 +37,7 @@ import TyCon import DataCon import PrelNames import BasicTypes hiding (SuccessFlag(..)) +import DynFlags ( DynFlag( Opt_GADTs ) ) import SrcLoc import ErrUtils import Util @@ -670,6 +671,12 @@ tcConPat pstate con_span data_con tycon pat_ty arg_pats thing_inside pstate' | no_equalities = pstate | otherwise = pstate { pat_eqs = True } + ; gadts_on <- doptM Opt_GADTs + ; checkTc (no_equalities || gadts_on) + (ptext (sLit "A pattern match on a GADT requires -XGADTs")) + -- Trac #2905 decided that a *pattern-match* of a GADT + -- should require the GADT language flag + ; unless no_equalities $ checkTc (isRigidTy pat_ty) $ nonRigidMatch (pat_ctxt pstate) data_con