[GHC] #14880: GHC panic: updateRole
GHC
ghc-devs at haskell.org
Tue Sep 11 12:24:39 UTC 2018
#14880: GHC panic: updateRole
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone: 8.8.1
Component: Compiler (Type | Version: 8.2.2
checker) |
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: #15076 | Differential Rev(s): Phab:D4769,
Wiki Page: | Phab:D5141
-------------------------------------+-------------------------------------
Comment (by simonpj):
Sigh.
For a start, `closeOverKinds` stupidly goes via `FV`, which is silly in
our new setup. Perhaps
{{{
closeOverKinds tv_set = tv_set `unionVarSet` mapUnionVarSet kind_fvs
tv_set
where
kind_fvs tcv = ty_co_vars_of_type (varType tv) emptyVarSet emptyVarSet
}}}
You might want to define
{{{
tyCoVarsOfType_unclosed :: Type -> TyCoVarSet
tyCoVarsOfTYpe_unclosed ty = ty_co_var_of_type emptyVarSet emptyVarSet
}}}
Next, I'd worry about that `mapUnionVarSet`. It seems that checking for
dups,
and avoiding unions, is a help. So perhaps
{{{
closeOverKinds tv_set = close emptyVarSet tv_set
where
close :: TyCoVarSet -> TyCoVarSet -> TyCoVarSet
-- (close acc tvs2) extends acc with tcvs closed over kinds
-- Invariant: acc is already closed-over-kinds
close acc tcvs = nonDetFoldUFM close1 acc tvs
close1 :: TyCoVar -> TyCoVarSet -> TyCoVarSet
close1 tcv acc
= add1 (close kind_vars acc)
where
kind_vars = ty_co_vars_of_type (varType tcv) acc emptyVarSet
add1 tvs2 | tcv `elemVarSet` tvs2 = tvs2
| otherwise = extendVarSet tvs2 tcv
}}}
By using the the "in-scope set" (first argument) of `ty_co_var_of_type`,
I'm saying "don't bother with variables whose kind we have already closed
over". And I'm trying to use `extendVarSet`, not `unionVarSet`.
I'm not certain I have this right, but I think it's close.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14880#comment:122>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list