Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
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
Adam Sandberg Eriksson
Glasgow Haskell Compiler
Commits
28188e06
Commit
28188e06
authored
Dec 10, 2018
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments only
parent
71e26a74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
compiler/rename/RnSource.hs
compiler/rename/RnSource.hs
+4
-2
compiler/simplCore/SetLevels.hs
compiler/simplCore/SetLevels.hs
+13
-9
No files found.
compiler/rename/RnSource.hs
View file @
28188e06
...
...
@@ -698,7 +698,7 @@ rnFamInstEqn :: HsDocContext
->
Maybe
(
Name
,
[
Name
])
-- Nothing => not associated
-- Just (cls,tvs) => associated,
-- and gives class and tyvars of the
-- parent instance de
lc
-- parent instance de
cl
->
[
Located
RdrName
]
-- Kind variables from the equation's RHS
->
FamInstEqn
GhcPs
rhs
->
(
HsDocContext
->
rhs
->
RnM
(
rhs'
,
FreeVars
))
...
...
@@ -801,7 +801,9 @@ rnFamInstEqn doc mb_cls rhs_kvars
rnFamInstEqn
_
_
_
(
HsIB
_
(
XFamEqn
_
))
_
=
panic
"rnFamInstEqn"
rnFamInstEqn
_
_
_
(
XHsImplicitBndrs
_
)
_
=
panic
"rnFamInstEqn"
rnTyFamInstDecl
::
Maybe
(
Name
,
[
Name
])
rnTyFamInstDecl
::
Maybe
(
Name
,
[
Name
])
-- Just (cls,tvs) => associated,
-- and gives class and tyvars of
-- the parent instance decl
->
TyFamInstDecl
GhcPs
->
RnM
(
TyFamInstDecl
GhcRn
,
FreeVars
)
rnTyFamInstDecl
mb_cls
(
TyFamInstDecl
{
tfid_eqn
=
eqn
})
...
...
compiler/simplCore/SetLevels.hs
View file @
28188e06
...
...
@@ -462,7 +462,7 @@ lvlCase :: LevelEnv -- Level of in-scope names/tyvars
lvlCase
env
scrut_fvs
scrut'
case_bndr
ty
alts
-- See Note [Floating single-alternative cases]
|
[(
con
@
(
DataAlt
{}),
bs
,
body
)]
<-
alts
,
exprIsHNF
(
deTagExpr
scrut'
)
-- See Note [Check the output scrutinee for
okForSpec
]
,
exprIsHNF
(
deTagExpr
scrut'
)
-- See Note [Check the output scrutinee for
exprIsHNF
]
,
not
(
isTopLvl
dest_lvl
)
-- Can't have top-level cases
,
not
(
floatTopLvlOnly
env
)
-- Can float anywhere
=
-- Always float the case if possible
...
...
@@ -535,21 +535,25 @@ Things to note:
* We only do this with a single-alternative case
Note [Check the output scrutinee for
okForSpec
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
Note [Check the output scrutinee for
exprIsHNF
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this:
case x of y {
A -> ....(case y of alts)....
}
Because of the binder-swap, the inner case will get substituted to
(case x of ..). So when testing whether the scrutinee is
okForSpeculation we must be careful to test the *result* scrutinee ('x'
in this case), not the *input* one 'y'. The latter *is* ok for
speculation here, but the former is not -- and indeed we can't float
the inner case out, at least not unless x is also evaluated at its
binding
site. See Trac #5453.
(case x of ..). So when testing whether the scrutinee is
in HNF we
must be careful to test the *result* scrutinee ('x' in this case), not
the *input* one 'y'. The latter *is* in HNF here (because y is
evaluated), but the former is not -- and indeed we can't float the
inner case out, at least not unless x is also evaluated at its binding
site. See Trac #5453.
That's why we apply exprIsHNF to scrut' and not to scrut.
See Note [Floating single-alternative cases] for why
we use exprIsHNF in the first place.
-}
lvlNonTailMFE
::
LevelEnv
-- Level of in-scope names/tyvars
...
...
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