diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2020-09-21 14:49:56 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-30 02:48:27 -0400 |
commit | 3ab0d8f77ec67676de40ebe6ff7e86756e5c761e (patch) | |
tree | 9b91405f7c7ad48f7ed8ec9a1cf65dbda4e349a9 /testsuite | |
parent | 8e3f00dd24936b6674d0a2322f8410125968583e (diff) | |
download | haskell-3ab0d8f77ec67676de40ebe6ff7e86756e5c761e.tar.gz |
PmCheck: Long-distance information for LocalBinds (#18626)
Now `desugarLocalBind` (formerly `desugarLet`) reasons about
* `FunBind`s that
* Have no pattern matches (so which aren't functions)
* Have a singleton match group with a single GRHS
* (which may have guards)
* and looks through trivial post-typechecking `AbsBinds` in doing so
to pick up the introduced renamings.
And desugars to `PmLet` LYG-style guards. Since GRHSs are no longer
denoted simply by `NonEmpty PmGRHS`, but also need to carry a `[PmGrd]`
for the `PmLet`s from `LocalBind`s, I added `PmGRHSs` to capture that.
Since we call out to the desugarer more often, I found that there were
superfluous warnings emitted when desugaring e.g. case expressions.
Thus, I made sure that we deactivate any warnings in the LYG desugaring
steps by the new wrapper function `noCheckDs`.
There's a regression test in `T18626`. Fixes #18626.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/T18626.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/all.T | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T18626.hs b/testsuite/tests/pmcheck/should_compile/T18626.hs new file mode 100644 index 0000000000..c0e70de5ad --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T18626.hs @@ -0,0 +1,11 @@ +{-# OPTIONS_GHC -Wincomplete-patterns -fforce-recomp #-} + +module Lib where + +x :: () +x | let y = True, y = () + +f :: Int -> () +f _ | y = () + where + y = True diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index ff56bdf0ba..e7f3667ea7 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -148,6 +148,8 @@ test('T18478', collect_compiler_stats('bytes allocated',10), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) test('T18533', normal, compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) +test('T18626', normal, compile, + ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) test('T18572', normal, compile, ['-fwarn-incomplete-patterns -fwarn-incomplete-uni-patterns -fwarn-overlapping-patterns']) test('T18609', normal, compile, |