summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-02-05 20:01:36 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-02-08 11:00:24 -0500
commit071bef18ccafb134ab886da9e362689b9f092dd3 (patch)
tree0fecf04831326cdeb21a225dfe430bf1fd0f98fb
parentced729f6f4651b67151015e25a98c93792794aee (diff)
downloadhaskell-071bef18ccafb134ab886da9e362689b9f092dd3.tar.gz
Fix optSemi type in Parser.y
The definition of 'optSemi' claimed it had type ([Located a],Bool) Note that its production actually returns ([Located Token],Bool): : ';' { ([$1],True) } -- $1 :: Located Token Due to an infelicity in the implementation of 'happy -c', it effectively resulted in 'unsafeCoerce :: Token -> a'. See https://github.com/simonmar/happy/pull/134 If any consumer of 'optSemi' tried to instantiate 'a' to something not representationally equal to 'Token', they would experience a segfault. In addition to that, this definition made it impossible to compile Parser.y without the -c flag (as it's reliant on this bug to cast 'Token' to 'forall a. a').
-rw-r--r--compiler/parser/Parser.y3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index c5b5c5f118..820144d930 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1,4 +1,3 @@
-
-- -*-haskell-*-
-- ---------------------------------------------------------------------------
-- (c) The University of Glasgow 1997-2003
@@ -2581,7 +2580,7 @@ exp10 :: { LHsExpr GhcPs }
| scc_annot exp {% ams (sLL $1 $> $ HsSCC noExt (snd $ fst $ unLoc $1) (snd $ unLoc $1) $2)
(fst $ fst $ unLoc $1) }
-optSemi :: { ([Located a],Bool) }
+optSemi :: { ([Located Token],Bool) }
: ';' { ([$1],True) }
| {- empty -} { ([],False) }