[GHC] #11334: GHC panic when calling typeOf on a promoted data constructor
GHC
ghc-devs at haskell.org
Wed Jan 27 20:58:59 UTC 2016
#11334: GHC panic when calling typeOf on a promoted data constructor
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: bgamari
Type: bug | Status: new
Priority: highest | Milestone: 8.0.1
Component: Compiler (Type | Version: 8.0.1-rc1
checker) |
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D1757
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Easier example is good (comment:11).
Hint: always debug a compiler built with `-DDEBUG`. My build shows
{{{
decideKindGeneralisationPlan
type: (Proxy
k1_aCf[tau:5]
('Other
k_aCn[tau:5]
f_aCo[tau:5]
a_aCp[tau:5] |> <f_aCo[tau:5] a_aCp[tau:5]
-> Other k_aCn[tau:5] f_aCo[tau:5]
a_aCp[tau:5]>_N) |> <*>_N)
ftvs: [k1_aCf[tau:5], f_aCo[tau:5], a_aCp[tau:5], k_aCn[tau:5]]
should gen? True
writeMetaTyVar k_aCn[tau:5] := *
writeMetaTyVar f_aCo[tau:5] := *
WARNING: file compiler\typecheck\TcMType.hs, line 553
Ill-kinded update to meta tyvar
f_aCo[tau:5] :: k_aCn[tau:5] -> *
* -> * := * :: *
*
writeMetaTyVar a_aCp[tau:5] := *
quantifyTyVars
globals: []
nondep: []
dep: [k_aCn[tau:5], f_aCo[tau:5], a_aCp[tau:5]]
dep2: []
quant_vars: []
}}}
Note the `WARNING`.
The bug is this code in `quantifyTyVars`:
{{{
-- In the non-PolyKinds case, default the kind variables
-- to *, and zonk the tyvars as usual. Notice that this
-- may make quantifyTyVars return a shorter list
-- than it was passed, but that's ok
; poly_kinds <- xoptM LangExt.PolyKinds
; dep_vars2 <- if poly_kinds
then return dep_kvs
else do { let (meta_kvs, skolem_kvs) = partition
is_meta dep_kvs
is_meta kv = isTcTyVar kv &&
isMetaTyVar kv
; mapM_ defaultKindVar meta_kvs
; return skolem_kvs } -- should be empty
}}}
But in this case the variables we are quantifying over (I hardly know
whether to call them type or kind variables now) are:
{{{
k_aCn :: *
f_aCo :: k_aCn -> *
a_aCp :: k_aCn
}}}
These appear in the user-written type signature which elaborates to:
{{{
Proxy ... (Other k_aCn f_aCo a_aCp)
}}}
It's clearly NOT RIGHT in the non-poly-kind case to default the "kind"
variables to `*`. I guess we have to use `Any` in the same way that we do
for types.
Can't do more tonight. Richard how are you set?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11334#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list