patch applied (ghc-6.6/ghc): Do not filter the type envt after each
GHCi stmt
Ian Lynagh
igloo at earth.li
Sat Nov 11 09:46:28 EST 2006
Tue Oct 10 07:32:25 PDT 2006 simonpj at microsoft.com
* Do not filter the type envt after each GHCi stmt
Fixes Trac #925
A new comment in TcRnDriver in tcRnStmt reads thus:
At one stage I removed any shadowed bindings from the type_env;
they are inaccessible but might, I suppose, cause a space leak if we leave them there.
However, with Template Haskell they aren't necessarily inaccessible. Consider this
GHCi session
Prelude> let f n = n * 2 :: Int
Prelude> fName <- runQ [| f |]
Prelude> $(return $ AppE fName (LitE (IntegerL 7)))
14
Prelude> let f n = n * 3 :: Int
Prelude> $(return $ AppE fName (LitE (IntegerL 7)))
In the last line we use 'fName', which resolves to the *first* 'f'
in scope. If we delete it from the type env, GHCi crashes because
it doesn't expect that.
M ./compiler/typecheck/TcRnDriver.lhs -5 +19
More information about the Cvs-ghc
mailing list