[Git][ghc/ghc][ghc-8.8] Fix optSemi type in Parser.y
Ben Gamari
gitlab at gitlab.haskell.org
Tue Jun 4 03:37:39 UTC 2019
Ben Gamari pushed to branch ghc-8.8 at Glasgow Haskell Compiler / GHC
Commits:
605869c7 by Vladislav Zavialov at 2019-06-03T21:28:12Z
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').
- - - - -
1 changed file:
- compiler/parser/Parser.y
Changes:
=====================================
compiler/parser/Parser.y
=====================================
@@ -1,4 +1,3 @@
-
-- -*-haskell-*-
-- ---------------------------------------------------------------------------
-- (c) The University of Glasgow 1997-2003
@@ -2586,7 +2585,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) }
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/605869c7b776ce6071a31ff447998b081e0354ed
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/605869c7b776ce6071a31ff447998b081e0354ed
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190603/66754a26/attachment.html>
More information about the ghc-commits
mailing list