diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-04-20 14:02:36 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-05-04 15:20:32 -0700 |
commit | bf4f3e653407d02593a69618fb199b2e2d529c92 (patch) | |
tree | 09f35064cc49a9eb3f32971a5bbf0b3d110eae8b /testsuite/tests | |
parent | f7dfcef47af9bf33837e0af3d391c45d12f17677 (diff) | |
download | haskell-bf4f3e653407d02593a69618fb199b2e2d529c92.tar.gz |
Give a hint when a TH splice has a bad package key, partially fixes #10279
Previously, if we got a package key in our splice, we'd give
a very unhelpful error message saying we couldn't find
a package 'base-4.7.0.1', despite there being a package with
that source package ID. Really, we couldn't find a package with
that *key*, so clarify, and also tell the user what the real
package key is.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/th/T10279.hs | 10 | ||||
-rw-r--r-- | testsuite/tests/th/T10279.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/th/T10279.hs b/testsuite/tests/th/T10279.hs new file mode 100644 index 0000000000..fbc2dbbf51 --- /dev/null +++ b/testsuite/tests/th/T10279.hs @@ -0,0 +1,10 @@ +module T10279 where +import Language.Haskell.TH +import Language.Haskell.TH.Syntax + +-- NB: rts-1.0 is used here because it doesn't change. +-- You do need to pick the right version number, otherwise the +-- error message doesn't recognize it as a source package ID, +-- (This is OK, since it will look obviously wrong when they +-- try to find the package in their package database.) +blah = $(conE (Name (mkOccName "Foo") (NameG VarName (mkPkgName "rts-1.0") (mkModName "A")))) diff --git a/testsuite/tests/th/T10279.stderr b/testsuite/tests/th/T10279.stderr new file mode 100644 index 0000000000..c5f7834eae --- /dev/null +++ b/testsuite/tests/th/T10279.stderr @@ -0,0 +1,8 @@ + +T10279.hs:10:10: error: + Failed to load interface for ‘A’ + no package key matching ‘rts-1.0’ was found + (This package key looks like the source package ID; + the real package key is ‘rts’) + In the expression: (rts-1.0:A.Foo) + In an equation for ‘blah’: blah = (rts-1.0:A.Foo) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index b7c241990a..dda8274c5b 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -360,6 +360,7 @@ test('T8624', normal, run_command, ['$MAKE -s --no-print-directory T8624']) test('TH_Lift', normal, compile, ['-v0']) test('T10047', normal, ghci_script, ['T10047.script']) test('T10019', normal, ghci_script, ['T10019.script']) +test('T10279', normal, compile_fail, ['-v0']) test('T10306', normal, compile, ['-v0']) test('TH_abstractFamily', normal, compile_fail, ['']) |