diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-07-02 12:55:37 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-07-05 07:07:38 -0400 |
commit | 62b82135a50b15869c425ef5e7dc35700e846228 (patch) | |
tree | 111215b13bc35298c52aac3115274e1175943d0d /testsuite | |
parent | a76b233d5a598b12f1921405cdcb27b0ea1b809d (diff) | |
download | haskell-62b82135a50b15869c425ef5e7dc35700e846228.tar.gz |
More sensible SrcSpans for recursive pattern synonym errors (#16900)
Attach the `SrcSpan` of the first pattern synonym binding involved in
the recursive group when throwing the corresponding error message,
similarly to how it is done for type synonyms.
Fixes #16900.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T16900.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T16900.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T16900.hs b/testsuite/tests/patsyn/should_fail/T16900.hs new file mode 100644 index 0000000000..972c90530a --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T16900.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE PatternSynonyms #-} +module T16900 where + +pattern P1 = P2 +pattern P2 = P1 diff --git a/testsuite/tests/patsyn/should_fail/T16900.stderr b/testsuite/tests/patsyn/should_fail/T16900.stderr new file mode 100644 index 0000000000..2838c7f867 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T16900.stderr @@ -0,0 +1,8 @@ + +T16900.hs:4:1: error: + Recursive pattern synonym definition with following bindings: + P1 (defined at T16900.hs:4:1-15) + P2 (defined at T16900.hs:5:1-15) + | +4 | pattern P1 = P2 + | ^^^^^^^^^^^^^^^ diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 5431e8b76a..27ebc8bdd4 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -45,3 +45,4 @@ test('T15289', normal, compile_fail, ['']) test('T15685', normal, compile_fail, ['']) test('T15692', normal, compile, ['']) # It has -fdefer-type-errors inside test('T15694', normal, compile_fail, ['']) +test('T16900', normal, compile_fail, ['-fdiagnostics-show-caret']) |