diff options
author | Eric Mertens <emertens@gmail.com> | 2014-10-07 08:48:37 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-10-07 08:48:38 -0500 |
commit | adcb9dbc0bfb6a7dd3f4f746e2f8cd620745db75 (patch) | |
tree | 5ebde7824e00cfaf08c4ab39e15f8e45d992862e /testsuite/tests/th/TH_linePragma.hs | |
parent | 2ee252783b732649f6075b769bd6b964e3823400 (diff) | |
download | haskell-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.hs | 11 |
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) ) |