summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2020-03-13 23:15:22 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-15 03:57:41 -0400
commitd30aeb4b38381758025bc1002eb2135ad6bc58b8 (patch)
tree31ff69aaeedf85e4e0f6c6450876326019c73e15
parent1de3ab4a147eeb0b34b24a3c0e91f174e6e5cb79 (diff)
downloadhaskell-d30aeb4b38381758025bc1002eb2135ad6bc58b8.tar.gz
Document restriction on SCC pragma syntax
Currently, the names of cost centres must be quoted or be lowercase identifiers. Fixes #17916.
-rw-r--r--docs/users_guide/profiling.rst2
-rw-r--r--testsuite/tests/profiling/should_fail/T17916.hs6
-rw-r--r--testsuite/tests/profiling/should_fail/T17916.stderr2
-rw-r--r--testsuite/tests/profiling/should_fail/all.T1
4 files changed, 10 insertions, 1 deletions
diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst
index 127944eb09..c9cb128613 100644
--- a/docs/users_guide/profiling.rst
+++ b/docs/users_guide/profiling.rst
@@ -220,7 +220,7 @@ semantics of the program, in accordance with `GHC Proposal #176
<https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0176-scc-parsing.rst>`__.
SCC stands for "Set Cost Centre". The double quotes can be omitted if ``name``
-is a Haskell identifier, for example: ::
+is a Haskell identifier starting with a lowercase letter, for example: ::
{-# SCC id #-} <expression>
diff --git a/testsuite/tests/profiling/should_fail/T17916.hs b/testsuite/tests/profiling/should_fail/T17916.hs
new file mode 100644
index 0000000000..8d87e8c64d
--- /dev/null
+++ b/testsuite/tests/profiling/should_fail/T17916.hs
@@ -0,0 +1,6 @@
+-- Currently, capitalized identifiers in SCC pragmas must be put in quotes.
+-- If you change this decision, this test is there to remind you to
+-- update the section scc-pragma in User's Guide.
+module T17916 where
+
+f = {-# SCC CapitalCase #-} ()
diff --git a/testsuite/tests/profiling/should_fail/T17916.stderr b/testsuite/tests/profiling/should_fail/T17916.stderr
new file mode 100644
index 0000000000..d7072126fe
--- /dev/null
+++ b/testsuite/tests/profiling/should_fail/T17916.stderr
@@ -0,0 +1,2 @@
+
+T17916.hs:6:13: error: parse error on input ‘CapitalCase’
diff --git a/testsuite/tests/profiling/should_fail/all.T b/testsuite/tests/profiling/should_fail/all.T
index 89e04d5344..00a7a16025 100644
--- a/testsuite/tests/profiling/should_fail/all.T
+++ b/testsuite/tests/profiling/should_fail/all.T
@@ -1,3 +1,4 @@
test('proffail001', normal, compile_fail, ['-prof -fprof-cafs'])
+test('T17916', normal, compile_fail, [''])