summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-10-11 09:26:46 -0400
committerBen Gamari <ben@smart-cactus.org>2016-10-12 11:52:39 -0400
commitbce99086e9f54909f51ff5a74cb8c666083bb021 (patch)
tree3456caa772779cccd04056a90d9b78367ad5515b /testsuite/tests/rename
parentd2959dfbbbc33a0a44c498d1e6b424615b7d756d (diff)
downloadhaskell-bce99086e9f54909f51ff5a74cb8c666083bb021.tar.gz
RnExpr: Actually fail if patterns found in expression
This fixes #12584, where wildcard patterns were snuck into an expression, which then crashed the typechecker in TcExpr since EWildPats aren't supposed to appear in the AST after renaming. The problem was that `rnTopSpliceDecl` failed to check for errors from `rnSplice` (as done by other callers to `rnSplice`). Thanks to Shayan for reporting this! Reviewers: simonpj, austin Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2539 GHC Trac Issues: #12584
Diffstat (limited to 'testsuite/tests/rename')
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
-rw-r--r--testsuite/tests/rename/should_fail/rnfail016.hs2
-rw-r--r--testsuite/tests/rename/should_fail/rnfail016.stderr2
-rw-r--r--testsuite/tests/rename/should_fail/rnfail016a.hs6
-rw-r--r--testsuite/tests/rename/should_fail/rnfail016a.stderr2
5 files changed, 9 insertions, 4 deletions
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 3ddfea29e4..9fc13b061f 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -13,6 +13,7 @@ test('rnfail013', normal, compile_fail, [''])
test('rnfail015', normal, compile_fail, [''])
test('rnfail016', normal, compile_fail, [''])
+test('rnfail016a', normal, compile_fail, [''])
test('rnfail017', normal, compile_fail, [''])
test('rnfail018', normal, compile_fail, [''])
test('rnfail019', normal, compile_fail, [''])
diff --git a/testsuite/tests/rename/should_fail/rnfail016.hs b/testsuite/tests/rename/should_fail/rnfail016.hs
index 1bf15b0421..7dccaa90b1 100644
--- a/testsuite/tests/rename/should_fail/rnfail016.hs
+++ b/testsuite/tests/rename/should_fail/rnfail016.hs
@@ -4,6 +4,4 @@ module ShouldFail where
-- !!! Pattern syntax in expressions
f x = x @ x
-g x = ~ x
-h x = _
diff --git a/testsuite/tests/rename/should_fail/rnfail016.stderr b/testsuite/tests/rename/should_fail/rnfail016.stderr
index 4013255797..47436132f2 100644
--- a/testsuite/tests/rename/should_fail/rnfail016.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail016.stderr
@@ -2,5 +2,3 @@
rnfail016.hs:6:7: error:
Pattern syntax in expression context: x@x
Did you mean to enable TypeApplications?
-
-rnfail016.hs:7:7: error: Pattern syntax in expression context: ~x
diff --git a/testsuite/tests/rename/should_fail/rnfail016a.hs b/testsuite/tests/rename/should_fail/rnfail016a.hs
new file mode 100644
index 0000000000..e0d7d65179
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/rnfail016a.hs
@@ -0,0 +1,6 @@
+{-# OPTIONS_GHC -fno-warn-typed-holes #-}
+module ShouldFail where
+
+-- !!! Pattern syntax in expressions
+
+f x = ~ x
diff --git a/testsuite/tests/rename/should_fail/rnfail016a.stderr b/testsuite/tests/rename/should_fail/rnfail016a.stderr
new file mode 100644
index 0000000000..3a59ee7478
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/rnfail016a.stderr
@@ -0,0 +1,2 @@
+
+rnfail016a.hs:6:7: error: Pattern syntax in expression context: ~x