[project @ 2004-03-12 21:37:27 by ross]
authorross <unknown>
Fri, 12 Mar 2004 21:37:27 +0000 (21:37 +0000)
committerross <unknown>
Fri, 12 Mar 2004 21:37:27 +0000 (21:37 +0000)
Deal gracefully with arrow commands where an expression is expected,
instead of panicking.  (Bug reported by Isaac Jones)

merge to STABLE

ghc/compiler/typecheck/TcExpr.lhs

index 1714a33..d0328f9 100644 (file)
@@ -327,6 +327,14 @@ tc_expr (ExplicitTuple exprs boxity) res_ty
 tc_expr (HsProc pat cmd) res_ty
   = tcProc pat cmd res_ty                      `thenM` \ (pat', cmd') ->
     returnM (HsProc pat' cmd')
+
+tc_expr e@(HsArrApp _ _ _ _ _) _
+  = failWithTc (vcat [ptext SLIT("The arrow command"), nest 2 (ppr e), 
+                      ptext SLIT("was found where an expression was expected")])
+
+tc_expr e@(HsArrForm _ _ _) _
+  = failWithTc (vcat [ptext SLIT("The arrow command"), nest 2 (ppr e), 
+                      ptext SLIT("was found where an expression was expected")])
 \end{code}
 
 %************************************************************************