diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2019-11-12 10:56:57 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-12-05 16:07:44 -0500 |
commit | 84585e5e7c5d729ce38fa47ebaa7518acd14c2f1 (patch) | |
tree | 0420df471d093d543c6eaa05946f8da51758dd4b /testsuite | |
parent | f03a41d4bf9418ee028ecb51654c928b2da74edd (diff) | |
download | haskell-84585e5e7c5d729ce38fa47ebaa7518acd14c2f1.tar.gz |
Meaning-preserving SCC annotations (#15730)
This patch implements GHC Proposal #176:
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0176-scc-parsing.rst
Before the change:
1 / 2 / 2 = 0.25
1 / {-# SCC "name" #-} 2 / 2 = 1.0
After the change:
1 / 2 / 2 = 0.25
1 / {-# SCC "name" #-} 2 / 2 = parse error
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/parser/should_compile/T15730a.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/T15730a.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T15730.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T15730.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T15730b.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T15730b.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/perf/compiler/T15164.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/profiling/should_run/prof-doc-last.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/profiling/should_run/prof-doc-last.prof.sample | 4 |
11 files changed, 30 insertions, 5 deletions
diff --git a/testsuite/tests/parser/should_compile/T15730a.hs b/testsuite/tests/parser/should_compile/T15730a.hs new file mode 100644 index 0000000000..5f1c45828a --- /dev/null +++ b/testsuite/tests/parser/should_compile/T15730a.hs @@ -0,0 +1,5 @@ +x = 1 / 2 / 2 +a = {-# SCC ann #-} 1 / 2 / 2 +b = 1 / 2 / {-# SCC ann #-} 2 + +main = print (x, a == x, b == x) diff --git a/testsuite/tests/parser/should_compile/T15730a.stdout b/testsuite/tests/parser/should_compile/T15730a.stdout new file mode 100644 index 0000000000..f8528ac72a --- /dev/null +++ b/testsuite/tests/parser/should_compile/T15730a.stdout @@ -0,0 +1 @@ +(0.25,True,True) diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 91aae139ab..85a7c3c172 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -162,3 +162,5 @@ test('proposal-229f', omit_ways(['profasm', 'profthreaded']) ], multimod_compile_and_run, ['proposal-229f.hs', '']) + +test('T15730a', normal, compile_and_run, ['']) diff --git a/testsuite/tests/parser/should_fail/T15730.hs b/testsuite/tests/parser/should_fail/T15730.hs new file mode 100644 index 0000000000..98c7689e1c --- /dev/null +++ b/testsuite/tests/parser/should_fail/T15730.hs @@ -0,0 +1,3 @@ +module T15730 where + +x = 1 / {-# SCC ann #-} 2 / 2 diff --git a/testsuite/tests/parser/should_fail/T15730.stderr b/testsuite/tests/parser/should_fail/T15730.stderr new file mode 100644 index 0000000000..32b5b33759 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T15730.stderr @@ -0,0 +1,2 @@ + +T15730.hs:3:27: error: parse error on input ‘/’ diff --git a/testsuite/tests/parser/should_fail/T15730b.hs b/testsuite/tests/parser/should_fail/T15730b.hs new file mode 100644 index 0000000000..01fa6e2eac --- /dev/null +++ b/testsuite/tests/parser/should_fail/T15730b.hs @@ -0,0 +1,8 @@ +module T15730b where + +(.!) :: (a, a) -> Bool -> a +a .! True = fst a +a .! False = snd a + +t :: Bool -> Integer +t x = (5,6) .! {-# SCC a1 #-} {-# SCC a2 #-} x :: Integer diff --git a/testsuite/tests/parser/should_fail/T15730b.stderr b/testsuite/tests/parser/should_fail/T15730b.stderr new file mode 100644 index 0000000000..5794dc00fe --- /dev/null +++ b/testsuite/tests/parser/should_fail/T15730b.stderr @@ -0,0 +1,2 @@ + +T15730b.hs:8:48: error: parse error on input ‘::’ diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index c4a7a4f67b..e0000f009e 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -163,3 +163,5 @@ test('patFail008', normal, compile_fail, ['']) test('patFail009', normal, compile_fail, ['']) test('T17162', normal, compile_fail, ['']) test('proposal-229c', normal, compile_fail, ['']) +test('T15730', normal, compile_fail, ['']) +test('T15730b', normal, compile_fail, ['']) diff --git a/testsuite/tests/perf/compiler/T15164.hs b/testsuite/tests/perf/compiler/T15164.hs index 0f29623228..1b67c901d5 100644 --- a/testsuite/tests/perf/compiler/T15164.hs +++ b/testsuite/tests/perf/compiler/T15164.hs @@ -252,7 +252,7 @@ instance Rule f Primary => Rule f Factor where -- ::= name newtype FormalDesignator = MkFormalDesignator (NT Name) instance Rule f Name => Rule f FormalDesignator where - get = trace "FormalDesignator" $ {-# SCC "get_FormalDesignator" #-} MkFormalDesignator <$> n93 + get = trace "FormalDesignator" $ {-# SCC "get_FormalDesignator" #-} (MkFormalDesignator <$> n93) -- formal_part -- ::= formal_designator diff --git a/testsuite/tests/profiling/should_run/prof-doc-last.hs b/testsuite/tests/profiling/should_run/prof-doc-last.hs index f5073fddc2..d74997d04b 100644 --- a/testsuite/tests/profiling/should_run/prof-doc-last.hs +++ b/testsuite/tests/profiling/should_run/prof-doc-last.hs @@ -2,6 +2,6 @@ main :: IO () main = do let xs = [1..1000000] let ys = [1..2000000] print $ {-# SCC "last_xs" #-} last xs - print $ {-# SCC "last_init_xs" #-} last $ init xs + print $ {-# SCC "last_init_xs" #-} last (init xs) print $ {-# SCC "last_ys" #-} last ys - print $ {-# SCC "last_init_ys" #-}last $ init ys + print $ {-# SCC "last_init_ys" #-} last (init ys) diff --git a/testsuite/tests/profiling/should_run/prof-doc-last.prof.sample b/testsuite/tests/profiling/should_run/prof-doc-last.prof.sample index 371fad43d7..f67863df48 100644 --- a/testsuite/tests/profiling/should_run/prof-doc-last.prof.sample +++ b/testsuite/tests/profiling/should_run/prof-doc-last.prof.sample @@ -8,7 +8,7 @@ COST CENTRE MODULE SRC %time %alloc main.ys Main prof-doc-last.hs:3:15-31 39.7 37.5 -last_init_ys Main prof-doc-last.hs:7:45-58 23.1 29.2 +last_init_ys Main prof-doc-last.hs:7:46-59 23.1 29.2 main.xs Main prof-doc-last.hs:2:15-31 23.1 18.7 last_init_xs Main prof-doc-last.hs:5:46-59 11.6 14.6 last_xs Main prof-doc-last.hs:4:41-47 1.7 0.0 @@ -27,7 +27,7 @@ MAIN MAIN <built-in> 46 CAF GHC.IO.Encoding.Iconv <entire-module> 65 0 0.0 0.0 0.0 0.0 main Main prof-doc-last.hs:(2,1)-(7,58) 93 0 0.0 0.0 100.0 100.0 last_init_xs Main prof-doc-last.hs:5:46-59 96 1 11.6 14.6 11.6 14.6 - last_init_ys Main prof-doc-last.hs:7:45-58 99 1 23.1 29.2 23.1 29.2 + last_init_ys Main prof-doc-last.hs:7:46-59 99 1 23.1 29.2 23.1 29.2 last_xs Main prof-doc-last.hs:4:41-47 94 1 1.7 0.0 1.7 0.0 last_ys Main prof-doc-last.hs:6:41-47 97 1 0.8 0.0 0.8 0.0 main.xs Main prof-doc-last.hs:2:15-31 95 1 23.1 18.7 23.1 18.7 |