diff options
author | Aaron Allen <aaron@flipstone.com> | 2020-07-03 18:23:55 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-07-13 09:00:33 -0400 |
commit | c2cfdfde20d0d6c0e16aa7a84d8ebe51501bcfa8 (patch) | |
tree | 80d16a83757247d441155c58aacb0c68103248d5 /testsuite/tests/warnings | |
parent | c4de6a7a5c6433ae8c4df8a9fa09fbd9f3bbd0bf (diff) | |
download | haskell-c2cfdfde20d0d6c0e16aa7a84d8ebe51501bcfa8.tar.gz |
Warn about empty Char enumerations (#18402)
Currently the "Enumeration is empty" warning (-Wempty-enumerations)
only fires for numeric literals. This patch adds support for `Char`
literals so that enumerating an empty list of `Char`s will also
trigger the warning.
Diffstat (limited to 'testsuite/tests/warnings')
-rw-r--r-- | testsuite/tests/warnings/should_compile/T18402.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/T18402.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/all.T | 2 |
3 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/warnings/should_compile/T18402.hs b/testsuite/tests/warnings/should_compile/T18402.hs new file mode 100644 index 0000000000..f18d3b5046 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T18402.hs @@ -0,0 +1,8 @@ +module T18402 where + +a = ['b' .. 'a'] -- empty +b = ['b', 'a' .. 'c'] -- empty +c = ['b', 'c' .. 'a'] -- empty +d = ['a' .. 'c'] -- not empty +e = ['a', 'c' .. 'b'] -- not empty + diff --git a/testsuite/tests/warnings/should_compile/T18402.stderr b/testsuite/tests/warnings/should_compile/T18402.stderr new file mode 100644 index 0000000000..1fe12832c9 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T18402.stderr @@ -0,0 +1,9 @@ + +T18402.hs:3:5: warning: [-Wempty-enumerations (in -Wdefault)] + Enumeration is empty + +T18402.hs:4:5: warning: [-Wempty-enumerations (in -Wdefault)] + Enumeration is empty + +T18402.hs:5:5: warning: [-Wempty-enumerations (in -Wdefault)] + Enumeration is empty diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T index 03c4fcb7b8..de46efcf1f 100644 --- a/testsuite/tests/warnings/should_compile/all.T +++ b/testsuite/tests/warnings/should_compile/all.T @@ -30,3 +30,5 @@ test('Overflow', expect_broken_for(16543, ['hpc']), compile, ['']) test('UnusedPackages', normal, multimod_compile, ['UnusedPackages.hs', '-package=bytestring -package=base -package=process -package=ghc -Wunused-packages']) + +test('T18402', normal, compile, ['']) |