Commit 6e4e6d1c authored by Alan Zimmerman's avatar Alan Zimmerman

Fix mkGadtDecl does not set con_forall correctly

A GADT declaration surrounded in parens does not det the con_forall
field correctly.

e.g.

data MaybeDefault v where
    TestParens  :: (forall v . (Eq v) => MaybeDefault v)

Closes #15323
parent 6bb0c5db
......@@ -643,7 +643,7 @@ mkGadtDecl :: [Located RdrName]
mkGadtDecl names ty
= (ConDeclGADT { con_g_ext = noExt
, con_names = names
, con_forall = L l $ isLHsForAllTy ty
, con_forall = L l $ isLHsForAllTy ty'
, con_qvars = mkHsQTvs tvs
, con_mb_cxt = mcxt
, con_args = args'
......
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
module T15323 where
data MaybeDefault v where
TestParens :: (forall v . (Eq v) => MaybeDefault v)
==================== Parser AST ====================
({ T15323.hs:1:1 }
(HsModule
(Just
({ T15323.hs:3:8-13 }
{ModuleName: T15323}))
(Nothing)
[]
[({ T15323.hs:(5,1)-(6,56) }
(TyClD
(NoExt)
(DataDecl
(NoExt)
({ T15323.hs:5:6-17 }
(Unqual
{OccName: MaybeDefault}))
(HsQTvs
(NoExt)
[({ T15323.hs:5:19 }
(UserTyVar
(NoExt)
({ T15323.hs:5:19 }
(Unqual
{OccName: v}))))])
(Prefix)
(HsDataDefn
(NoExt)
(DataType)
({ <no location info> }
[])
(Nothing)
(Nothing)
[({ T15323.hs:6:5-56 }
(ConDeclGADT
(NoExt)
[({ T15323.hs:6:5-14 }
(Unqual
{OccName: TestParens}))]
({ T15323.hs:6:21-55 }
(True))
(HsQTvs
(NoExt)
[({ T15323.hs:6:28 }
(UserTyVar
(NoExt)
({ T15323.hs:6:28 }
(Unqual
{OccName: v}))))])
(Just
({ T15323.hs:6:32-37 }
[({ T15323.hs:6:32-37 }
(HsParTy
(NoExt)
({ T15323.hs:6:33-36 }
(HsAppTy
(NoExt)
({ T15323.hs:6:33-34 }
(HsTyVar
(NoExt)
(NotPromoted)
({ T15323.hs:6:33-34 }
(Unqual
{OccName: Eq}))))
({ T15323.hs:6:36 }
(HsTyVar
(NoExt)
(NotPromoted)
({ T15323.hs:6:36 }
(Unqual
{OccName: v}))))))))]))
(PrefixCon
[])
({ T15323.hs:6:42-55 }
(HsAppTy
(NoExt)
({ T15323.hs:6:42-53 }
(HsTyVar
(NoExt)
(NotPromoted)
({ T15323.hs:6:42-53 }
(Unqual
{OccName: MaybeDefault}))))
({ T15323.hs:6:55 }
(HsTyVar
(NoExt)
(NotPromoted)
({ T15323.hs:6:55 }
(Unqual
{OccName: v}))))))
(Nothing)))]
({ <no location info> }
[])))))]
(Nothing)
(Nothing)))
......@@ -116,3 +116,4 @@ test('T14189', normal, compile, ['-dsuppress-uniques -ddump-rn-ast'])
test('T13986', normal, compile, [''])
test('T10855', normal, compile, [''])
test('T15139', normal, compile, ['-Wincomplete-patterns -fdiagnostics-show-caret'])
test('T15323', normal, compile, ['-dsuppress-uniques -ddump-parsed-ast'])
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