Support SCC pragmas in declaration context
Not having SCCs at the top level is becoming annoying real quick. For simplest cases, it's possible to do this transformation: f x y = ... => f = {-# SCC f #-} \x y -> ... However, it doesn't work when there's a `where` clause: f x y = <t is in scope> where t = ... => f = {-# SCC f #-} \x y -> <t is out of scope> where t = ... Or when we have a "equation style" definition: f (C1 ...) = ... f (C2 ...) = ... f (C3 ...) = ... ... (usual solution is to rename `f` to `f'` and define a new `f` with a `SCC`) This patch implements support for SCC annotations in declaration contexts. This is now a valid program: f x y = ... where g z = ... {-# SCC g #-} {-# SCC f #-} Test Plan: This passes slow validate (no new failures added). Reviewers: goldfire, mpickering, austin, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: simonmar, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2407
Showing
- compiler/deSugar/DsMeta.hs 2 additions, 2 deletionscompiler/deSugar/DsMeta.hs
- compiler/hsSyn/HsBinds.hs 23 additions, 1 deletioncompiler/hsSyn/HsBinds.hs
- compiler/parser/Parser.y 27 additions, 11 deletionscompiler/parser/Parser.y
- compiler/rename/RnBinds.hs 9 additions, 0 deletionscompiler/rename/RnBinds.hs
- compiler/typecheck/TcBinds.hs 22 additions, 1 deletioncompiler/typecheck/TcBinds.hs
- compiler/typecheck/TcSigs.hs 2 additions, 1 deletioncompiler/typecheck/TcSigs.hs
- docs/users_guide/8.2.1-notes.rst 5 additions, 1 deletiondocs/users_guide/8.2.1-notes.rst
- docs/users_guide/profiling.rst 19 additions, 2 deletionsdocs/users_guide/profiling.rst
- testsuite/config/ghc 2 additions, 0 deletionstestsuite/config/ghc
- testsuite/tests/profiling/should_run/all.T 6 additions, 1 deletiontestsuite/tests/profiling/should_run/all.T
- testsuite/tests/profiling/should_run/toplevel_scc_1.hs 23 additions, 0 deletionstestsuite/tests/profiling/should_run/toplevel_scc_1.hs
- testsuite/tests/profiling/should_run/toplevel_scc_1.prof.sample 30 additions, 0 deletions...ite/tests/profiling/should_run/toplevel_scc_1.prof.sample
- testsuite/tests/profiling/should_run/toplevel_scc_1.stdin 1 addition, 0 deletionstestsuite/tests/profiling/should_run/toplevel_scc_1.stdin
- testsuite/tests/profiling/should_run/toplevel_scc_1.stdout 1 addition, 0 deletionstestsuite/tests/profiling/should_run/toplevel_scc_1.stdout
Loading
Please register or sign in to comment