Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,327
Issues
4,327
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
363
Merge Requests
363
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
c5b1014e
Commit
c5b1014e
authored
Apr 28, 2016
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix debug-only check in CoreLint
parent
c4dd4ae7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
compiler/coreSyn/CoreLint.hs
compiler/coreSyn/CoreLint.hs
+9
-7
No files found.
compiler/coreSyn/CoreLint.hs
View file @
c5b1014e
...
...
@@ -657,7 +657,8 @@ lintCoreExpr (Lam var expr)
lintCoreExpr
e
@
(
Case
scrut
var
alt_ty
alts
)
=
-- Check the scrutinee
do
{
scrut_ty
<-
lintCoreExpr
scrut
do
{
let
scrut_diverges
=
exprIsBottom
scrut
;
scrut_ty
<-
lintCoreExpr
scrut
;
(
alt_ty
,
_
)
<-
lintInTy
alt_ty
;
(
var_ty
,
_
)
<-
lintInTy
(
idType
var
)
...
...
@@ -665,7 +666,7 @@ lintCoreExpr e@(Case scrut var alt_ty alts) =
;
when
(
null
alts
)
$
do
{
checkL
(
not
(
exprIsHNF
scrut
))
(
text
"No alternatives for a case scrutinee in head-normal form:"
<+>
ppr
scrut
)
;
checkL
(
exprIsBottom
scrut
)
;
checkL
scrut_diverges
(
text
"No alternatives for a case scrutinee not known to diverge for sure:"
<+>
ppr
scrut
)
}
...
...
@@ -680,11 +681,12 @@ lintCoreExpr e@(Case scrut var alt_ty alts) =
;
case
tyConAppTyCon_maybe
(
idType
var
)
of
Just
tycon
|
debugIsOn
&&
isAlgTyCon
tycon
&&
not
(
isFamilyTyCon
tycon
||
isAbstractTyCon
tycon
)
&&
null
(
tyConDataCons
tycon
)
->
pprTrace
"Lint warning: case binder's type has no constructors"
(
ppr
var
<+>
ppr
(
idType
var
))
|
debugIsOn
,
isAlgTyCon
tycon
,
not
(
isAbstractTyCon
tycon
)
,
null
(
tyConDataCons
tycon
)
,
not
scrut_diverges
->
pprTrace
"Lint warning: case binder's type has no constructors"
(
ppr
var
<+>
ppr
(
idType
var
))
-- This can legitimately happen for type families
$
return
()
_otherwise
->
return
()
...
...
Write
Preview
Markdown
is supported
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