[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: typecheck: Drop SPECIALISE pragmas when there is no unfolding

Marge Bot gitlab at gitlab.haskell.org
Tue Aug 11 19:58:00 UTC 2020



 Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
229d3e6e by Ben Gamari at 2020-08-11T15:57:57-04:00
typecheck: Drop SPECIALISE pragmas when there is no unfolding

Previously the desugarer would instead fall over when it realized that
there was no unfolding for an imported function with a SPECIALISE
pragma. We now rather drop the SPECIALISE pragma and throw a warning.

Fixes #18118.

- - - - -
85c35c0e by Ben Gamari at 2020-08-11T15:57:57-04:00
testsuite: Add test for #18118

- - - - -
22968ac1 by Sven Tennie at 2020-08-11T15:57:57-04:00
Add hie.yaml to ghc-heap

This enables IDE support by haskell-language-server for ghc-heap.

- - - - -
7fef72f6 by Ben Gamari at 2020-08-11T15:57:57-04:00
testsuite: Specify metrics collected by T17516

Previously it collected everything, including "max bytes used". This is
problematic since the test makes no attempt to control for deviations in
GC timing, resulting in high variability. Fix this by only collecting
"bytes allocated".

- - - - -


6 changed files:

- compiler/GHC/Tc/Gen/Sig.hs
- + libraries/ghc-heap/hie.yaml
- testsuite/tests/perf/compiler/all.T
- + testsuite/tests/typecheck/should_compile/T18118.hs
- + testsuite/tests/typecheck/should_compile/T18118A.hs
- testsuite/tests/typecheck/should_compile/all.T


Changes:

=====================================
compiler/GHC/Tc/Gen/Sig.hs
=====================================
@@ -826,9 +826,13 @@ tcImpPrags prags
 tcImpSpec :: (Name, Sig GhcRn) -> TcM [TcSpecPrag]
 tcImpSpec (name, prag)
  = do { id <- tcLookupId name
-      ; unless (isAnyInlinePragma (idInlinePragma id))
-               (addWarnTc NoReason (impSpecErr name))
-      ; tcSpecPrag id prag }
+      ; if isAnyInlinePragma (idInlinePragma id)
+        then tcSpecPrag id prag
+        else do { addWarnTc NoReason (impSpecErr name)
+                ; return [] } }
+      -- If there is no INLINE/INLINABLE pragma there will be no unfolding. In
+      -- that case, just delete the SPECIALISE pragma altogether, lest the
+      -- desugarer fall over because it can't find the unfolding. See #18118.
 
 impSpecErr :: Name -> SDoc
 impSpecErr name


=====================================
libraries/ghc-heap/hie.yaml
=====================================
@@ -0,0 +1,12 @@
+cradle:
+  multi:
+    - path: ./GHC/
+      config:
+        cradle:
+          cabal:
+            component: 'lib:ghc-heap'
+    - path: ./tests
+      config:
+        cradle:
+          direct:
+            arguments: []


=====================================
testsuite/tests/perf/compiler/all.T
=====================================
@@ -370,7 +370,7 @@ test('T16190',
 test('T16473', normal, makefile_test, ['T16473'])
 
 test('T17516',
-      [ collect_compiler_stats(),
+      [ collect_compiler_stats('bytes allocated', 5),
         extra_clean(['T17516A.hi', 'T17516A.o'])
       ],
       multimod_compile,


=====================================
testsuite/tests/typecheck/should_compile/T18118.hs
=====================================
@@ -0,0 +1,5 @@
+module T18118 (myfun) where
+
+import T18118A
+
+{-# SPECIALISE myfun :: Double #-}


=====================================
testsuite/tests/typecheck/should_compile/T18118A.hs
=====================================
@@ -0,0 +1,5 @@
+module T18118A where
+
+myfun :: a
+myfun = undefined
+


=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -717,5 +717,6 @@ test('T17775-viewpats-a', normal, compile, [''])
 test('T17775-viewpats-b', normal, compile_fail, [''])
 test('T17775-viewpats-c', normal, compile_fail, [''])
 test('T17775-viewpats-d', normal, compile_fail, [''])
+test('T18118', normal, multimod_compile, ['T18118', '-v0'])
 test('T18412', normal, compile, [''])
 test('T18470', normal, compile, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/14575e70224a5a0e6cacb58d0c9a69e17bbc2821...7fef72f6860bc89af0a8096a4f00b789a96616f9

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/14575e70224a5a0e6cacb58d0c9a69e17bbc2821...7fef72f6860bc89af0a8096a4f00b789a96616f9
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/20200811/aaa6d126/attachment-0001.html>


More information about the ghc-commits mailing list