[GHC] #12785: GHC panic, `tcTyVarDetails` is missing a case
GHC
ghc-devs at haskell.org
Tue Jan 10 12:53:15 UTC 2017
#12785: GHC panic, `tcTyVarDetails` is missing a case
-------------------------------------+-------------------------------------
Reporter: heisenbug | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case: yes
Blocked By: | Blocking:
Related Tickets: #12590 | Differential Rev(s): Phab:D2931
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
OK I have worked it out.
We use `tyCoVarsOfType`, `tyCoVarsOfCt` etc to extract the free type
variables of a type or constraint. We don't have functions `tyVarsOfType`
etc; they would be simple to write, but we don't have them.
That means that we may get unwanted coercion variables floating around in
the result set. This is annoying, and one alternative would be to add a
family of functions returning tyvars.
But returning the coercion variables (which appear in casts in types)
actually causes no trouble ''provided all the "is" functions return False
for coercion variables''.
For example,
{{{
promoteTyVar tclvl tv
| isFloatedTouchableMetaTyVar tclvl tv
= ...
| otherwise
= return ()
}}}
Here `tv` might be a coercion variable, but it'll be ignored provided
`isFloatedTouchableMetaTyVar` ignores it.
So I'm ok with revering the patch, but please can we add a big Note with
those functions explaining why coercion variables can occur is happening?
Incidentally, in `TcSimplify` we have this:
{{{
; let meta_tvs = filter (isTyVar <&&> isMetaTyVar) free_tvs
...
-- The isTyVar needs to weed out coercion variables
}}}
Once `isMetaTyVar` filters out coercion variables, we can remove the
`isTyVar` here.
Reid: over to you.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12785#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list