[DHG_packages] 01/01: ghc: Add upstream patch to avoid find_tycon panic

Ilias Tsitsimpis iliastsi-guest at moszumanska.debian.org
Sat Oct 29 17:12:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

iliastsi-guest pushed a commit to branch master
in repository DHG_packages.

commit 9bd25df90f9a6fe85cb799ff6375e08e6a616e39
Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
Date:   Sat Oct 29 20:05:00 2016 +0300

    ghc: Add upstream patch to avoid find_tycon panic
---
 p/ghc/debian/changelog                |  6 ++++++
 p/ghc/debian/patches/find-tycon-panic | 40 +++++++++++++++++++++++++++++++++++
 p/ghc/debian/patches/series           |  1 +
 3 files changed, 47 insertions(+)

diff --git a/p/ghc/debian/changelog b/p/ghc/debian/changelog
index 01fe6ed..88474b1 100644
--- a/p/ghc/debian/changelog
+++ b/p/ghc/debian/changelog
@@ -1,3 +1,9 @@
+ghc (8.0.1-9) UNRELEASED; urgency=medium
+
+  * Add upstream patch to avoid find_tycon panic
+
+ -- Ilias Tsitsimpis <i.tsitsimpis at gmail.com>  Sat, 29 Oct 2016 20:03:26 +0300
+
 ghc (8.0.1-8) unstable; urgency=medium
 
   * Upload to unstable to start GHC 8 transition.
diff --git a/p/ghc/debian/patches/find-tycon-panic b/p/ghc/debian/patches/find-tycon-panic
new file mode 100644
index 0000000..968dbc3
--- /dev/null
+++ b/p/ghc/debian/patches/find-tycon-panic
@@ -0,0 +1,40 @@
+From: Adam Gundry <adam at well-typed.com>
+Subject: Avoid find_tycon panic if datacon is not in scope
+
+When using TH to splice expressions involving record field construction,
+the parent datacon may not be in scope.  We shouldn't panic about this,
+because we will be renaming Exact RdrNames which don't require any
+disambiguation.
+
+Reviewers: austin, bgamari
+Reviewed By: bgamari
+Differential Revision: https://phabricator.haskell.org/D2321
+GHC Trac Issues: #12130
+
+Origin: upstream, https://git.haskell.org/ghc.git/commitdiff/694e0f3a08030
+
+Index: b/compiler/rename/RnPat.hs
+===================================================================
+--- a/compiler/rename/RnPat.hs
++++ b/compiler/rename/RnPat.hs
+@@ -636,7 +636,7 @@ rnHsRecFields ctxt mk_arg (HsRecFields {
+     find_tycon :: GlobalRdrEnv -> Name {- DataCon -} -> Maybe Name {- TyCon -}
+     -- Return the parent *type constructor* of the data constructor
+     -- (that is, the parent of the data constructor),
+-    -- or 'Nothing' if it is a pattern synonym.
++    -- or 'Nothing' if it is a pattern synonym or not in scope.
+     -- That's the parent to use for looking up record fields.
+     find_tycon env con
+       | Just (AConLike (RealDataCon dc)) <- wiredInNameTyThing_maybe con
+@@ -648,8 +648,9 @@ rnHsRecFields ctxt mk_arg (HsRecFields {
+           ParentIs p -> Just p
+           _          -> Nothing
+ 
+-      | otherwise
+-      = pprPanic "find_tycon" (ppr con $$ ppr (lookupGRE_Name env con))
++      | otherwise = Nothing
++        -- This can happen if the datacon is not in scope
++        -- and we are in a TH splice (Trac #12130)
+ 
+     dup_flds :: [[RdrName]]
+         -- Each list represents a RdrName that occurred more than once
diff --git a/p/ghc/debian/patches/series b/p/ghc/debian/patches/series
index 0e9152a..7371f2c 100644
--- a/p/ghc/debian/patches/series
+++ b/p/ghc/debian/patches/series
@@ -8,3 +8,4 @@ do-not-use-SHELL
 add-missing-MO_WriteBarrier
 opt-pic
 no-pie
+find-tycon-panic

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/DHG_packages.git



More information about the Pkg-haskell-commits mailing list