summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_fail
diff options
context:
space:
mode:
authorChristiaan Baaij <christiaan.baaij@gmail.com>2021-11-15 18:09:09 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-25 11:35:49 -0400
commit1d673aa25205084d3973a3e9c7b7cd84a8b3171c (patch)
tree46091c83ce0c11d0f010e3a6096dbc3564de7127 /testsuite/tests/parser/should_fail
parent5ff690b8474c74e9c968ef31e568c1ad0fe719a1 (diff)
downloadhaskell-1d673aa25205084d3973a3e9c7b7cd84a8b3171c.tar.gz
Add the OPAQUE pragma
A new pragma, `OPAQUE`, that ensures that every call of a named function annotated with an `OPAQUE` pragma remains a call of that named function, not some name-mangled variant. Implements GHC proposal 0415: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0415-opaque-pragma.rst This commit also updates the haddock submodule to handle the newly introduced lexer tokens corresponding to the OPAQUE pragma.
Diffstat (limited to 'testsuite/tests/parser/should_fail')
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail1.hs4
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail1.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail2.hs4
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail2.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail3.hs4
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail3.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail4.hs6
-rw-r--r--testsuite/tests/parser/should_fail/OpaqueParseFail4.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/all.T4
9 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail1.hs b/testsuite/tests/parser/should_fail/OpaqueParseFail1.hs
new file mode 100644
index 0000000000..368b73f2d7
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail1.hs
@@ -0,0 +1,4 @@
+module OpaqueParseFail1 where
+
+f = id
+{-# OPAQUE[1] f #-}
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail1.stderr b/testsuite/tests/parser/should_fail/OpaqueParseFail1.stderr
new file mode 100644
index 0000000000..057b3a8f92
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail1.stderr
@@ -0,0 +1,2 @@
+OpaqueParseFail1.hs:4:11: error:
+ parse error on input ‘[’
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail2.hs b/testsuite/tests/parser/should_fail/OpaqueParseFail2.hs
new file mode 100644
index 0000000000..e9685581e8
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail2.hs
@@ -0,0 +1,4 @@
+module OpaqueParseFail2 where
+
+f = id
+{-# OPAQUE SPECIALISE f :: Int -> Int #-}
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail2.stderr b/testsuite/tests/parser/should_fail/OpaqueParseFail2.stderr
new file mode 100644
index 0000000000..5c4063bd23
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail2.stderr
@@ -0,0 +1,2 @@
+OpaqueParseFail2.hs:4:12: error:
+ parse error on input ‘SPECIALISE’
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail3.hs b/testsuite/tests/parser/should_fail/OpaqueParseFail3.hs
new file mode 100644
index 0000000000..a3a13aeba0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail3.hs
@@ -0,0 +1,4 @@
+module OpaqueParseFail2 where
+
+f = id
+{-# OPAQUE CONLIKE f #-}
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail3.stderr b/testsuite/tests/parser/should_fail/OpaqueParseFail3.stderr
new file mode 100644
index 0000000000..7680f18ead
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail3.stderr
@@ -0,0 +1,2 @@
+OpaqueParseFail3.hs:4:12: error:
+ parse error on input ‘CONLIKE’
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail4.hs b/testsuite/tests/parser/should_fail/OpaqueParseFail4.hs
new file mode 100644
index 0000000000..aecd866fb9
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail4.hs
@@ -0,0 +1,6 @@
+module OpaqueParseWarn2 where
+
+f :: Num a => a -> a
+f = (+1)
+{-# OPAQUE f #-}
+{-# INLINE f #-}
diff --git a/testsuite/tests/parser/should_fail/OpaqueParseFail4.stderr b/testsuite/tests/parser/should_fail/OpaqueParseFail4.stderr
new file mode 100644
index 0000000000..413b4fcc0c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/OpaqueParseFail4.stderr
@@ -0,0 +1,4 @@
+OpaqueParseFail4.hs:6:12: error:
+ Duplicate INLINE pragmas for ‘f’
+ at OpaqueParseFail4.hs:5:12
+ OpaqueParseFail4.hs:6:12
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
index b3a79e38c4..1d90ab407e 100644
--- a/testsuite/tests/parser/should_fail/all.T
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -201,3 +201,7 @@ test('ParserNoTH2', normal, compile_fail, [''])
test('T17865', normal, compile_fail, [''])
test('T20654a', normal, compile_fail, [''])
test('T20654b', normal, compile_fail, [''])
+test('OpaqueParseFail1', normal, compile_fail, [''])
+test('OpaqueParseFail2', normal, compile_fail, [''])
+test('OpaqueParseFail3', normal, compile_fail, [''])
+test('OpaqueParseFail4', normal, compile_fail, [''])