diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-08-16 11:53:33 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2018-08-16 11:53:34 +0200 |
commit | 5238f204482ac7f05f4e2d2e92576288cc00d42d (patch) | |
tree | 2759d8706459ea8f222a49a6c2330481c51e42e7 /testsuite/tests | |
parent | 7a63f75353d73743d7c57bbbee701f67210a64de (diff) | |
download | haskell-5238f204482ac7f05f4e2d2e92576288cc00d42d.tar.gz |
Fix #15527 by pretty-printing an RdrName prefixly
Summary:
When `(.) @Int` is used without enabling `TypeApplications`,
the resulting error message will pretty-print the (symbolic)
`RdrName` `(.)`. However, it does so without parenthesizing it, which
causes the pretty-printed expression to appear as `.@Int`. Yuck.
Since the expression in a type application will always be prefix,
we can fix this issue by using `pprPrefixOcc` instead of plain ol'
`ppr`.
Test Plan: make test TEST=T15527
Reviewers: bgamari, monoidal, simonpj
Reviewed By: monoidal, simonpj
Subscribers: rwbarton, carter
GHC Trac Issues: #15527
Differential Revision: https://phabricator.haskell.org/D5071
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T15527.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T15527.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T15527.hs b/testsuite/tests/typecheck/should_fail/T15527.hs new file mode 100644 index 0000000000..b65c26ca7a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T15527.hs @@ -0,0 +1,4 @@ +module T15527 where + +f :: (Int -> Int) -> (Int -> Int) -> (Int -> Int) +f = (.) @Int diff --git a/testsuite/tests/typecheck/should_fail/T15527.stderr b/testsuite/tests/typecheck/should_fail/T15527.stderr new file mode 100644 index 0000000000..dd03a0a0ca --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T15527.stderr @@ -0,0 +1,4 @@ + +T15527.hs:4:6: error: + Pattern syntax in expression context: (.)@Int + Did you mean to enable TypeApplications? diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 962ffb71c8..9c4df89238 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -478,3 +478,4 @@ test('T15330', normal, compile_fail, ['']) test('T15361', normal, compile_fail, ['']) test('T15438', normal, compile_fail, ['']) test('T15523', normal, compile_fail, ['-O']) +test('T15527', normal, compile_fail, ['']) |