[commit: ghc] tc-untouchables: When defaulting, check for *meta* tyvars (b493d39)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : tc-untouchables

http://hackage.haskell.org/trac/ghc/changeset/b493d397261572df1e28dc4e4ae4e9e3f446f2b1

>---------------------------------------------------------------

commit b493d397261572df1e28dc4e4ae4e9e3f446f2b1
Author: Simon Peyton Jones <[email protected]>
Date:   Mon Sep 3 18:46:45 2012 +0100

    When defaulting, check for *meta* tyvars
    
    I'd forgotten that we can have runtime skolems
    (TcTyVarDetails = RuntimeUnk), and we definitely
    don't want to attempt to default them!

>---------------------------------------------------------------

 compiler/typecheck/TcSimplify.lhs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/compiler/typecheck/TcSimplify.lhs b/compiler/typecheck/TcSimplify.lhs
index e749570..7b6a0de 100644
--- a/compiler/typecheck/TcSimplify.lhs
+++ b/compiler/typecheck/TcSimplify.lhs
@@ -1183,7 +1183,9 @@ in the cache!
 \begin{code}
 applyTyVarDefaulting :: WantedConstraints -> TcS ()
 applyTyVarDefaulting wc 
-  = do { let tvs = varSetElems (tyVarsOfWC wc) 
+  = do { let tvs = filter isMetaTyVar (varSetElems (tyVarsOfWC wc))
+                   -- We might have runtime-skolems in GHCi, and 
+                   -- we definitely don't want to try to assign to those!
        ; traceTcS "applyTyVarDefaulting {" (ppr tvs)
        ; mapM_ defaultTyVar tvs
        ; traceTcS "applyTyVarDefaulting end }" empty }
@@ -1250,6 +1252,8 @@ findDefaultableGroups (default_tys, (ovl_strings, extended_defaults)) wanteds
     find_unary cc 
         | Just (cls,[ty]) <- getClassPredTys_maybe (ctPred cc)
         , Just tv <- tcGetTyVar_maybe ty
+        , isMetaTyVar tv  -- We might have runtime-skolems in GHCi, and 
+                          -- we definitely don't want to try to assign to those!
         = Left (cc, cls, tv)
     find_unary cc = Right cc  -- Non unary or non dictionary
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.