summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_linePragma.hs
diff options
context:
space:
mode:
authorEric Mertens <emertens@gmail.com>2014-10-07 08:48:37 -0500
committerAustin Seipp <austin@well-typed.com>2014-10-07 08:48:38 -0500
commitadcb9dbc0bfb6a7dd3f4f746e2f8cd620745db75 (patch)
tree5ebde7824e00cfaf08c4ab39e15f8e45d992862e /testsuite/tests/th/TH_linePragma.hs
parent2ee252783b732649f6075b769bd6b964e3823400 (diff)
downloadhaskell-adcb9dbc0bfb6a7dd3f4f746e2f8cd620745db75.tar.gz
Add support for LINE pragma in template-haskell
Summary: Provide a way to generate {-# LINE #-} pragmas when generating Decs in Template Haskell. This allows more meaningful line numbers to be reported in compile-time errors for dynamically generated code. Test Plan: Run test suite Reviewers: austin, hvr Reviewed By: austin Subscribers: hvr, simonmar, ezyang, carter, thomie Differential Revision: https://phabricator.haskell.org/D299
Diffstat (limited to 'testsuite/tests/th/TH_linePragma.hs')
-rw-r--r--testsuite/tests/th/TH_linePragma.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_linePragma.hs b/testsuite/tests/th/TH_linePragma.hs
new file mode 100644
index 0000000000..39eec1ddd8
--- /dev/null
+++ b/testsuite/tests/th/TH_linePragma.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+-- Test that LINE pragmas influence type error messages correctly
+
+module ShouldFail where
+
+import Language.Haskell.TH
+
+$( do p <- pragLineD 42 "virtual file"
+ ds <- [d| x = $(varE (mkName "doesntExist")) |]
+ return (p:ds) )