Commit 43468fe3 authored by eir@cis.upenn.edu's avatar eir@cis.upenn.edu

Fix #11241.

When renaming a type, now looks for wildcards in bound variables'
kinds.

testcase: dependent/should_compile/T11241
parent 6f952f58
......@@ -147,7 +147,9 @@ rnWcSigTy env (L loc hs_ty@(HsForAllTy { hst_bndrs = tvs, hst_body = hs_tau }))
Nothing [] tvs $ \ _ tvs' ->
do { (hs_tau', fvs) <- rnWcSigTy env hs_tau
; let hs_ty' = HsForAllTy { hst_bndrs = tvs', hst_body = hswc_body hs_tau' }
; return ( hs_tau' { hswc_body = L loc hs_ty' }, fvs) }
awcs_bndrs = collectAnonWildCardsBndrs tvs'
; return ( hs_tau' { hswc_wcs = hswc_wcs hs_tau' ++ awcs_bndrs
, hswc_body = L loc hs_ty' }, fvs) }
rnWcSigTy env (L loc (HsQualTy { hst_ctxt = hs_ctxt, hst_body = tau }))
= do { (hs_ctxt', fvs1) <- rnWcSigContext env hs_ctxt
......@@ -1043,6 +1045,11 @@ collectAnonWildCards lty = go lty
prefix_types_only (HsAppPrefix ty) = Just ty
prefix_types_only (HsAppInfix _) = Nothing
collectAnonWildCardsBndrs :: [LHsTyVarBndr Name] -> [Name]
collectAnonWildCardsBndrs ltvs = concatMap (go . unLoc) ltvs
where
go (UserTyVar _) = []
go (KindedTyVar _ ki) = collectAnonWildCards ki
{-
*********************************************************
......
{-# LANGUAGE ExplicitForAll, KindSignatures, PartialTypeSignatures #-}
module T11241 where
foo :: forall (a :: _) . a -> a
foo = id
T11241.hs:5:21: warning:
• Found type wildcard ‘_’ standing for ‘*’
• In the type signature:
foo :: forall (a :: _). a -> a
• Relevant bindings include foo :: a -> a (bound at T11241.hs:6:1)
......@@ -16,4 +16,4 @@ test('T9632', normal, compile, [''])
test('dynamic-paper', expect_fail_for(['optasm', 'optllvm']), compile, [''])
test('T11311', normal, compile, [''])
test('T11405', normal, compile, [''])
test('T11241', normal, compile, [''])
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