diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-10-21 10:47:28 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-23 02:42:59 -0400 |
commit | 711929e6bcbcd5439dbf748cb57f56088b9a9f16 (patch) | |
tree | 5f1632202c2e89b1160e4fe3faee62962f6390f7 /testsuite | |
parent | e2c4a94708e4d8789ce97bd8b034e62f0e8b81c6 (diff) | |
download | haskell-711929e6bcbcd5439dbf748cb57f56088b9a9f16.tar.gz |
Fix error message location in tcCheckPatSynDecl
Ticket #18856 showed that we were failing to set the right location
for an error message. Easy to fix, happily.
Turns out that this also improves the error location in test T11010,
which was bogus before but we had never noticed.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T11010.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T18856.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T18856.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 3 |
4 files changed, 27 insertions, 2 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T11010.stderr b/testsuite/tests/patsyn/should_fail/T11010.stderr index 28216760ee..af081b6a36 100644 --- a/testsuite/tests/patsyn/should_fail/T11010.stderr +++ b/testsuite/tests/patsyn/should_fail/T11010.stderr @@ -1,5 +1,5 @@ -T11010.hs:9:36: error: +T11010.hs:9:34: error: • Couldn't match type ‘a1’ with ‘Int’ Expected: a -> b Actual: a1 -> b @@ -12,3 +12,6 @@ T11010.hs:9:36: error: • Relevant bindings include x :: Expr a1 (bound at T11010.hs:9:36) f :: a1 -> b (bound at T11010.hs:9:34) + | +9 | pattern IntFun str f x = Fun str f x + | ^ diff --git a/testsuite/tests/patsyn/should_fail/T18856.hs b/testsuite/tests/patsyn/should_fail/T18856.hs new file mode 100644 index 0000000000..780a734d53 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T18856.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE PatternSynonyms, ViewPatterns #-} + +module T18856 where + +pattern P :: Int -> Bool -> (Int, Bool, [(Bool,Bool)]) +pattern P p q <- (q, p, [(True,False)]) + diff --git a/testsuite/tests/patsyn/should_fail/T18856.stderr b/testsuite/tests/patsyn/should_fail/T18856.stderr new file mode 100644 index 0000000000..ceee029102 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T18856.stderr @@ -0,0 +1,14 @@ + +T18856.hs:6:19: error: + • Couldn't match expected type ‘Bool’ with actual type ‘Int’ + • In the declaration for pattern synonym ‘P’ + | +6 | pattern P p q <- (q, p, [(True,False)]) + | ^ + +T18856.hs:6:22: error: + • Couldn't match expected type ‘Int’ with actual type ‘Bool’ + • In the declaration for pattern synonym ‘P’ + | +6 | pattern P p q <- (q, p, [(True,False)]) + | ^ diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 02cc2cec2c..5faea83c88 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -9,7 +9,7 @@ test('T9705-2', normal, compile_fail, ['']) test('unboxed-bind', normal, compile_fail, ['']) test('unboxed-wrapper-naked', normal, compile_fail, ['']) test('T10873', normal, compile_fail, ['']) -test('T11010', normal, compile_fail, ['']) +test('T11010', normal, compile_fail, ['-fdiagnostics-show-caret']) test('records-check-sels', normal, compile_fail, ['']) test('records-no-uni-update', normal, compile_fail, ['']) test('records-no-uni-update2', normal, compile_fail, ['']) @@ -47,3 +47,4 @@ test('T15692', normal, compile, ['']) # It has -fdefer-type-errors inside test('T15694', normal, compile_fail, ['']) test('T16900', normal, compile_fail, ['-fdiagnostics-show-caret']) test('T14552', normal, compile_fail, ['']) +test('T18856', normal, compile_fail, ['-fdiagnostics-show-caret']) |