[Git][ghc/ghc][master] Do not report error if Name in pragma is unbound

Marge Bot gitlab at gitlab.haskell.org
Sun Jun 9 22:45:35 UTC 2019



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
ed20412a by nineonine at 2019-06-09T22:45:31Z
Do not report error if Name in pragma is unbound

- - - - -


4 changed files:

- compiler/rename/RnEnv.hs
- + testsuite/tests/rename/should_fail/T16610.hs
- + testsuite/tests/rename/should_fail/T16610.stderr
- testsuite/tests/rename/should_fail/all.T


Changes:

=====================================
compiler/rename/RnEnv.hs
=====================================
@@ -68,6 +68,7 @@ import PrelNames        ( rOOT_MAIN )
 import BasicTypes       ( pprWarningTxtForMsg, TopLevelFlag(..))
 import SrcLoc
 import Outputable
+import UniqSet          ( uniqSetAny )
 import Util
 import Maybes
 import DynFlags
@@ -1462,7 +1463,9 @@ lookupBindGroupOcc ctxt what rdr_name
       RoleAnnotCtxt ns -> lookup_top (`elemNameSet` ns)
       LocalBindCtxt ns -> lookup_group ns
       ClsDeclCtxt  cls -> lookup_cls_op cls
-      InstDeclCtxt ns  -> lookup_top (`elemNameSet` ns)
+      InstDeclCtxt ns  -> if uniqSetAny isUnboundName ns -- #16610
+                          then return (Right $ mkUnboundNameRdr rdr_name)
+                          else lookup_top (`elemNameSet` ns)
   where
     lookup_cls_op cls
       = lookupSubBndrOcc True cls doc rdr_name


=====================================
testsuite/tests/rename/should_fail/T16610.hs
=====================================
@@ -0,0 +1,6 @@
+module T16610 where
+
+data Foo = Foo
+instance Eq Foo where
+  {-# INLINE wrong #-}
+  wrong _ = True


=====================================
testsuite/tests/rename/should_fail/T16610.stderr
=====================================
@@ -0,0 +1,3 @@
+
+T16610.hs:6:3: error:
+    ‘wrong’ is not a (visible) method of class ‘Eq’


=====================================
testsuite/tests/rename/should_fail/all.T
=====================================
@@ -150,3 +150,4 @@ test('T15957_Fail', normal, compile_fail, ['-Werror -Wall -Wno-missing-signature
 test('T16385', normal, compile_fail, [''])
 test('T16504', normal, compile_fail, [''])
 test('T14548', normal, compile_fail, [''])
+test('T16610', normal, compile_fail, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/ed20412a8ce7578d073461892c9643591c6993a5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/ed20412a8ce7578d073461892c9643591c6993a5
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/20190609/0dd68f6e/attachment-0001.html>


More information about the ghc-commits mailing list