From: simonmar Date: Mon, 22 Apr 2002 13:08:34 +0000 (+0000) Subject: [project @ 2002-04-22 13:08:34 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~2128 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a5f88e3b92b831ec08c35aac58fc47d3403d881d;p=ghc-hetmet.git [project @ 2002-04-22 13:08:34 by simonmar] Throw out OpApp patterns where the operator is not a constructor here, rather than later in the typechecker(!). --- diff --git a/ghc/compiler/parser/ParseUtil.lhs b/ghc/compiler/parser/ParseUtil.lhs index 9b8b6c9..6314914 100644 --- a/ghc/compiler/parser/ParseUtil.lhs +++ b/ghc/compiler/parser/ParseUtil.lhs @@ -49,7 +49,7 @@ import SrcLoc import RdrHsSyn import RdrName import PrelNames ( unitTyCon_RDR ) -import OccName ( dataName, varName, tcClsName, +import OccName ( dataName, varName, tcClsName, isDataOcc, occNameSpace, setOccNameSpace, occNameUserString ) import CStrings ( CLabelString ) import FastString ( nullFastString ) @@ -212,7 +212,8 @@ checkPat e [] = case e of OpApp l op fix r -> checkPat l [] `thenP` \l -> checkPat r [] `thenP` \r -> case op of - HsVar c -> returnP (ConOpPatIn l c fix r) + HsVar c | isDataOcc (rdrNameOcc c) + -> returnP (ConOpPatIn l c fix r) _ -> patFail HsPar e -> checkPat e [] `thenP` (returnP . ParPatIn)