Commit 571f0adc authored by Simon Peyton Jones's avatar Simon Peyton Jones

Line up kind and type variables correctly when desugaring TH brackets

This bug was causing Trac #9199
parent b60df0fa
......@@ -63,6 +63,7 @@ import DynFlags
import FastString
import ForeignCall
import Util
import TcRnMonad( traceOptIf )
import Data.Maybe
import Control.Monad
......@@ -707,12 +708,14 @@ addTyVarBinds :: LHsTyVarBndrs Name -- the binders to
-- the computations passed as the second argument is executed in that extended
-- meta environment and gets the *new* names on Core-level as an argument
addTyVarBinds tvs m
= do { freshNames <- mkGenSyms (hsLKiTyVarNames tvs)
; term <- addBinds freshNames $
do { kbs <- repList tyVarBndrTyConName mk_tv_bndr (hsQTvBndrs tvs `zip` freshNames)
addTyVarBinds (HsQTvs { hsq_kvs = kvs, hsq_tvs = tvs }) m
= do { fresh_kv_names <- mkGenSyms kvs
; fresh_tv_names <- mkGenSyms (map hsLTyVarName tvs)
; let fresh_names = fresh_kv_names ++ fresh_tv_names
; term <- addBinds fresh_names $
do { kbs <- repList tyVarBndrTyConName mk_tv_bndr (tvs `zip` fresh_tv_names)
; m kbs }
; wrapGenSyms freshNames term }
; wrapGenSyms fresh_names term }
where
mk_tv_bndr (tv, (_,v)) = repTyVarBndrWithKind tv (coreVar v)
......
{-# LANGUAGE TemplateHaskell, PolyKinds, TypeFamilies #-}
module T9160 where
$( [d| class C (a :: k) where
type F (a :: k) :: *
|]
)
......@@ -327,4 +327,5 @@ test('T8954', normal, compile, ['-v0'])
test('T8932', normal, compile_fail, ['-v0'])
test('T8987', normal, compile_fail, ['-v0'])
test('T7241', normal, compile_fail, ['-v0'])
test('T9199', normal, compile, ['-v0'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment