Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry
curry-frontend
Commits
f8d57b2f
Commit
f8d57b2f
authored
Jun 07, 2016
by
Kirchmayr
Browse files
Added warnings for unused and unexported functions in WarnCheck, fixes #1054
parent
ee71aa43
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Checks/WarnCheck.hs
View file @
f8d57b2f
...
...
@@ -57,9 +57,9 @@ import CompilerOpts
warnCheck
::
WarnOpts
->
AliasEnv
->
ValueEnv
->
TCEnv
->
Module
->
[
Message
]
warnCheck
opts
aEnv
valEnv
tcEnv
(
Module
_
mid
es
is
ds
)
=
runOn
(
initWcState
mid
aEnv
valEnv
tcEnv
(
wnWarnFlags
opts
))
$
do
checkExports
es
checkImports
is
checkDeclGroup
ds
checkExports
es
checkMissingTypeSignatures
ds
checkModuleAlias
is
...
...
@@ -121,8 +121,14 @@ runOn s f = sort $ warnings $ execState f s
-- checkExports
-- ---------------------------------------------------------------------------
checkExports
::
Maybe
ExportSpec
->
WCM
()
checkExports
_
=
ok
-- TODO
checkExports
::
Maybe
ExportSpec
->
WCM
()
-- TODO checks
checkExports
Nothing
=
ok
checkExports
(
Just
(
Exporting
_
exports
))
=
do
mapM_
visitExport
exports
reportUnusedVars
where
visitExport
(
Export
qid
)
=
visitQId
qid
visitExport
_
=
ok
-- ---------------------------------------------------------------------------
-- checkImports
...
...
@@ -296,8 +302,7 @@ checkEquation (Equation _ lhs rhs) = inNestedScope $ do
reportUnusedVars
checkLhs
::
Lhs
->
WCM
()
checkLhs
(
FunLhs
f
ts
)
=
do
visitId
f
checkLhs
(
FunLhs
_
ts
)
=
do
mapM_
checkPattern
ts
mapM_
(
insertPattern
False
)
ts
checkLhs
(
OpLhs
t1
op
t2
)
=
checkLhs
(
FunLhs
op
[
t1
,
t2
])
...
...
test/TestFrontend.hs
View file @
f8d57b2f
...
...
@@ -282,4 +282,8 @@ warnInfos = map (uncurry mkFailTest)
[
"Unused declaration of variable `x'"
,
"Shadowing symbol `x'"
])
,
(
"TabCharacter"
,
[
"Tab character"
])
,
(
"UnexportedFunction"
,
[
"Unused declaration of variable `q'"
,
"Unused declaration of variable `g'"
]
)
]
test/warning/UnexportedFunction.curry
0 → 100644
View file @
f8d57b2f
module M (f) where
f :: a -> a
f x = x
where
q :: Int -> Int
q i = i+42
g :: a -> a
g x = x
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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