Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
5663a7b8
Commit
5663a7b8
authored
Aug 08, 2006
by
simonpj
Browse files
Add tests for incomplete-pattern warnings
parent
b34a1531
Changes
2
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/deSugar/should_compile/all.T
View file @
5663a7b8
...
...
@@ -62,3 +62,4 @@ test('ds055', only_compiler_types(['ghc']), compile, [''])
test
('
ds056
',
normal
,
compile
,
['
-Wall
'])
test
('
ds057
',
normal
,
compile
,
[''])
test
('
ds058
',
normal
,
compile
,
['
-W
'])
test
('
ds059
',
normal
,
compile
,
['
-W
'])
testsuite/tests/ghc-regress/deSugar/should_compile/ds059.hs
0 → 100644
View file @
5663a7b8
{-# OPTIONS -fwarn-incomplete-patterns #-}
-- Test for incomplete-pattern warnings
-- None should cause a warning
module
ShouldCompile
where
-- These ones gave bogus warnings in 6.2
data
D
=
D1
{
f1
::
Int
}
|
D2
-- Use pattern matching in the argument
f
::
D
->
D
f
d1
@
(
D1
{
f1
=
n
})
=
d1
{
f1
=
f1
d1
+
n
}
-- Warning here
f
d
=
d
-- Use case pattern matching
g
::
D
->
D
g
d1
=
case
d1
of
D1
{
f1
=
n
}
->
d1
{
f1
=
n
+
1
}
-- Warning here also
D2
->
d1
-- These ones were from Neil Mitchell
-- no warning
ex1
x
=
ss
where
(
_s
:
ss
)
=
x
-- no warning
ex2
x
=
let
(
_s
:
ss
)
=
x
in
ss
-- Warning: Pattern match(es) are non-exhaustive
-- In a case alternative: Patterns not matched: []
ex3
x
=
case
x
of
~
(
_s
:
ss
)
->
ss
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment