[commit: ghc] wip/marge_bot_batch_merge_job: Fix optSemi type in Parser.y (879fc87)
git at git.haskell.org
git at git.haskell.org
Thu Feb 7 17:12:13 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/marge_bot_batch_merge_job
Link : http://ghc.haskell.org/trac/ghc/changeset/879fc879934a4c97cffa20140c130b67a122414d/ghc
>---------------------------------------------------------------
commit 879fc879934a4c97cffa20140c130b67a122414d
Author: Vladislav Zavialov <vlad.z.4096 at gmail.com>
Date: Tue Feb 5 20:01:36 2019 -0500
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').
>---------------------------------------------------------------
879fc879934a4c97cffa20140c130b67a122414d
compiler/parser/Parser.y | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index ce5c523..2d1e8f3 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1,4 +1,3 @@
-
-- -*-haskell-*-
-- ---------------------------------------------------------------------------
-- (c) The University of Glasgow 1997-2003
@@ -2580,7 +2579,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) }
More information about the ghc-commits
mailing list