Permalink
Browse files

Implement parser change, fixing #12389

  • Loading branch information...
parsonsmatt committed Oct 29, 2017
1 parent b3544c7 commit 97561e566b1524a971ab4511ce26b6c8623438b4
Showing with 22 additions and 11 deletions.
  1. +12 −9 compiler/parser/Parser.y
  2. +10 −2 testsuite/tests/parser/should_compile/T12389.hs
@@ -804,21 +804,24 @@ export_subspec :: { Located ([AddAnn],ImpExpSubSpec) }


qcnames :: { ([AddAnn], [Located ImpExpQcSpec]) }
: {- empty -} { ([],[]) }
| qcnames1 { $1 }
: qcnames1 { $1 }
| qcnames1 ',' { $1 }

qcnames1 :: { ([AddAnn], [Located ImpExpQcSpec]) } -- A reversed list
: qcnames1 ',' qcname_ext_w_wildcard {% case (head (snd $1)) of
l@(L _ ImpExpQcWildcard) ->
return ([mj AnnComma $2, mj AnnDotdot l]
,(snd (unLoc $3) : snd $1))
l -> (ams (head (snd $1)) [mj AnnComma $2] >>
return (fst $1 ++ fst (unLoc $3),
snd (unLoc $3) : snd $1)) }
: qcnames1 ',' qcname_ext_w_wildcard {% let ret@(_, second) = ( fst $1 ++ fst (unLoc $3)
, snd (unLoc $3) : snd $1 )
in case (snd $1) of
(l@(L _ ImpExpQcWildcard) : _) ->
return ([mj AnnComma $2, mj AnnDotdot l]
,second)
(l : _) -> (ams l [mj AnnComma $2] >>
return ret)
[] -> return ret }


-- Annotations re-added in mkImpExpSubSpec
| qcname_ext_w_wildcard { (fst (unLoc $1),[snd (unLoc $1)]) }
| {- empty -} { ([], []) }

-- Variable, data constructor or wildcard
-- or tagged type constructor
@@ -1,5 +1,13 @@
module T12389
( T(, A, C, )
( E()
, A(A)
, B(, B)
, C(C, )
, D(,D,)
) where

data T = A | B
data A = A
data B = B
data C = C
data D = D
data E = E

0 comments on commit 97561e5

Please sign in to comment.