diff options
author | simonpj@microsoft.com <unknown> | 2011-01-12 17:07:19 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2011-01-12 17:07:19 +0000 |
commit | 024aa13a0a6bfd2d68f4c551824357b87e732f5b (patch) | |
tree | d0be399a3f7e1a13d234aaacdfb964920b7c4d4d /compiler/rename/RnExpr.lhs | |
parent | 28b45c520a106a464595540b044e8af1cc71b5c8 (diff) | |
download | haskell-024aa13a0a6bfd2d68f4c551824357b87e732f5b.tar.gz |
Produce an error message, not a crash, for HsOpApp with non-var operator
Fixes Trac #4877.
Diffstat (limited to 'compiler/rename/RnExpr.lhs')
-rw-r--r-- | compiler/rename/RnExpr.lhs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rename/RnExpr.lhs b/compiler/rename/RnExpr.lhs index 4b5071f8d1..6d425d0822 100644 --- a/compiler/rename/RnExpr.lhs +++ b/compiler/rename/RnExpr.lhs @@ -131,8 +131,8 @@ rnExpr (HsApp fun arg) rnLExpr arg `thenM` \ (arg',fvArg) -> return (HsApp fun' arg', fvFun `plusFV` fvArg) -rnExpr (OpApp e1 (L op_loc (HsVar op_rdr)) _ e2) - = do { (e1', fv_e1) <- rnLExpr e1 +rnExpr (OpApp e1 (L op_loc (HsVar op_rdr)) _ e2) + = do { (e1', fv_e1) <- rnLExpr e1 ; (e2', fv_e2) <- rnLExpr e2 ; op_name <- setSrcSpan op_loc (lookupOccRn op_rdr) ; (op', fv_op) <- finishHsVar op_name @@ -146,6 +146,10 @@ rnExpr (OpApp e1 (L op_loc (HsVar op_rdr)) _ e2) ; fixity <- lookupFixityRn op_name ; final_e <- mkOpAppRn e1' (L op_loc op') fixity e2' ; return (final_e, fv_e1 `plusFV` fv_op `plusFV` fv_e2) } +rnExpr (OpApp _ other_op _ _) + = failWith (vcat [ hang (ptext (sLit "Operator application with a non-variable operator:")) + 2 (ppr other_op) + , ptext (sLit "(Probably resulting from a Template Haskell splice)") ]) rnExpr (NegApp e _) = rnLExpr e `thenM` \ (e', fv_e) -> |