#3901: Panic from combining generalized list comprehensions and record wildcards
-------------------------------+--------------------------------------------
Reporter: amthrax | Owner: igloo
Type: merge | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.12.1
Keywords: | Difficulty:
Os: Linux | Testcase: rename/should_compile/T3901
Architecture: x86_64 (amd64) | Failure: Compile-time crash
-------------------------------+--------------------------------------------
Changes (by simonpj):
* owner: => igloo
* testcase: => rename/should_compile/T3901
* type: bug => merge
Comment:
Great catch, thank you. Fixed by
{{{
Thu Mar 4 12:53:37 GMT 2010 [email protected]
* Refactor part of the renamer to fix Trac #3901
This one was bigger than I anticipated! The problem was that were
were gathering the binders from a pattern before renaming -- but with
record wild-cards we don't know what variables are bound by C {..}
until after the renamer has filled in the "..".
So this patch does the following
* Change all the collect-X-Binders functions in HsUtils so that
they expect to only be called *after* renaming. That means they
don't need to return [Located id] but just [id]. Which turned out
to be a very worthwhile simplification all by itself.
* Refactor the renamer, and in ptic RnExpr.rnStmt, so that it
doesn't need to use collectLStmtsBinders on pre-renamed Stmts.
* This in turn required me to understand how GroupStmt and
TransformStmts were renamed. Quite fiddly. I rewrote most of it;
result is much shorter.
* In doing so I flattened HsExpr.GroupByClause into its parent
GroupStmt, with trivial knock-on effects in other files.
Blargh.
M ./compiler/deSugar/Coverage.lhs -20 +17
M ./compiler/deSugar/DsArrows.lhs -22 +18
M ./compiler/deSugar/DsListComp.lhs -25 +19
M ./compiler/deSugar/DsMeta.hs -6 +6
M ./compiler/hsSyn/HsExpr.lhs -38 +65
M ./compiler/hsSyn/HsPat.lhs -1 +1
M ./compiler/hsSyn/HsUtils.lhs -102 +142
M ./compiler/rename/RnBinds.lhs -3 +3
M ./compiler/rename/RnEnv.lhs -2 +10
M ./compiler/rename/RnExpr.lhs -151 +119
M ./compiler/rename/RnPat.lhs -1 +2
M ./compiler/rename/RnSource.lhs -3 +3
M ./compiler/typecheck/TcBinds.lhs -1 +1
M ./compiler/typecheck/TcDeriv.lhs -1 +1
M ./compiler/typecheck/TcHsSyn.lhs -19 +8
M ./compiler/typecheck/TcMatches.lhs -36 +37
M ./compiler/typecheck/TcRnDriver.lhs -2 +2
}}}
You could try merging this to 6.12, but it's a big patch, so it might not
be worth the bother. I'll make Ian the owner so he can check.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3901#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs